mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-22 05:23:09 -06:00
Fix pinecone monolith test with Stop working properly
This commit is contained in:
parent
a2be8ca873
commit
4dab13a5da
|
|
@ -51,7 +51,6 @@ import (
|
||||||
"github.com/matrix-org/dendrite/setup/base"
|
"github.com/matrix-org/dendrite/setup/base"
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
"github.com/matrix-org/dendrite/setup/config"
|
||||||
"github.com/matrix-org/dendrite/setup/jetstream"
|
"github.com/matrix-org/dendrite/setup/jetstream"
|
||||||
"github.com/matrix-org/dendrite/setup/process"
|
|
||||||
"github.com/matrix-org/dendrite/test"
|
"github.com/matrix-org/dendrite/test"
|
||||||
"github.com/matrix-org/dendrite/userapi"
|
"github.com/matrix-org/dendrite/userapi"
|
||||||
userapiAPI "github.com/matrix-org/dendrite/userapi/api"
|
userapiAPI "github.com/matrix-org/dendrite/userapi/api"
|
||||||
|
|
@ -80,6 +79,7 @@ const (
|
||||||
|
|
||||||
type DendriteMonolith struct {
|
type DendriteMonolith struct {
|
||||||
logger logrus.Logger
|
logger logrus.Logger
|
||||||
|
baseDendrite *base.BaseDendrite
|
||||||
PineconeRouter *pineconeRouter.Router
|
PineconeRouter *pineconeRouter.Router
|
||||||
PineconeMulticast *pineconeMulticast.Multicast
|
PineconeMulticast *pineconeMulticast.Multicast
|
||||||
PineconeQUIC *pineconeSessions.Sessions
|
PineconeQUIC *pineconeSessions.Sessions
|
||||||
|
|
@ -88,7 +88,6 @@ type DendriteMonolith struct {
|
||||||
CacheDirectory string
|
CacheDirectory string
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
httpServer *http.Server
|
httpServer *http.Server
|
||||||
processContext *process.ProcessContext
|
|
||||||
userAPI userapiAPI.UserInternalAPI
|
userAPI userapiAPI.UserInternalAPI
|
||||||
federationAPI api.FederationInternalAPI
|
federationAPI api.FederationInternalAPI
|
||||||
relayServersQueried map[gomatrixserverlib.ServerName]bool
|
relayServersQueried map[gomatrixserverlib.ServerName]bool
|
||||||
|
|
@ -343,9 +342,9 @@ func (m *DendriteMonolith) Start() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
base := base.NewBaseDendrite(cfg, "Monolith")
|
base := base.NewBaseDendrite(cfg, "Monolith", base.DisableMetrics)
|
||||||
|
m.baseDendrite = base
|
||||||
base.ConfigureAdminEndpoints()
|
base.ConfigureAdminEndpoints()
|
||||||
defer base.Close() // nolint: errcheck
|
|
||||||
|
|
||||||
federation := conn.CreateFederationClient(base, m.PineconeQUIC)
|
federation := conn.CreateFederationClient(base, m.PineconeQUIC)
|
||||||
|
|
||||||
|
|
@ -434,8 +433,6 @@ func (m *DendriteMonolith) Start() {
|
||||||
Handler: h2c.NewHandler(pMux, h2s),
|
Handler: h2c.NewHandler(pMux, h2s),
|
||||||
}
|
}
|
||||||
|
|
||||||
m.processContext = base.ProcessContext
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
m.logger.Info("Listening on ", cfg.Global.ServerName)
|
m.logger.Info("Listening on ", cfg.Global.ServerName)
|
||||||
|
|
||||||
|
|
@ -443,7 +440,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
case net.ErrClosed, http.ErrServerClosed:
|
case net.ErrClosed, http.ErrServerClosed:
|
||||||
m.logger.Info("Stopped listening on ", cfg.Global.ServerName)
|
m.logger.Info("Stopped listening on ", cfg.Global.ServerName)
|
||||||
default:
|
default:
|
||||||
m.logger.Fatal(err)
|
m.logger.Error("Stopped listening on ", cfg.Global.ServerName)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
|
|
@ -453,7 +450,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
case net.ErrClosed, http.ErrServerClosed:
|
case net.ErrClosed, http.ErrServerClosed:
|
||||||
m.logger.Info("Stopped listening on ", cfg.Global.ServerName)
|
m.logger.Info("Stopped listening on ", cfg.Global.ServerName)
|
||||||
default:
|
default:
|
||||||
m.logger.Fatal(err)
|
m.logger.Error("Stopped listening on ", cfg.Global.ServerName)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
@ -498,12 +495,12 @@ func (m *DendriteMonolith) Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DendriteMonolith) Stop() {
|
func (m *DendriteMonolith) Stop() {
|
||||||
m.processContext.ShutdownDendrite()
|
m.baseDendrite.Close()
|
||||||
|
m.baseDendrite.WaitForShutdown()
|
||||||
_ = m.listener.Close()
|
_ = m.listener.Close()
|
||||||
m.PineconeMulticast.Stop()
|
m.PineconeMulticast.Stop()
|
||||||
_ = m.PineconeQUIC.Close()
|
_ = m.PineconeQUIC.Close()
|
||||||
_ = m.PineconeRouter.Close()
|
_ = m.PineconeRouter.Close()
|
||||||
m.processContext.WaitForComponentsToFinish()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type RelayServerRetriever struct {
|
type RelayServerRetriever struct {
|
||||||
|
|
|
||||||
|
|
@ -194,5 +194,5 @@ func TestMonolithStarts(t *testing.T) {
|
||||||
monolith := DendriteMonolith{}
|
monolith := DendriteMonolith{}
|
||||||
monolith.Start()
|
monolith.Start()
|
||||||
monolith.PublicKey()
|
monolith.PublicKey()
|
||||||
// monolith.Stop()
|
monolith.Stop()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue