One NATS instance per BaseDendrite (#2438)

* One NATS instance per `BaseDendrite`

* Fix roomserver
This commit is contained in:
Neil Alexander 2022-05-09 14:15:24 +01:00 committed by GitHub
parent 79e2fbc663
commit 09d754cfbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 49 additions and 37 deletions

View file

@ -10,9 +10,9 @@ import (
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/roomserver/internal/input"
"github.com/matrix-org/dendrite/roomserver/storage"
"github.com/matrix-org/dendrite/setup/base"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/setup/jetstream"
"github.com/matrix-org/dendrite/setup/process"
"github.com/matrix-org/dendrite/test"
"github.com/matrix-org/gomatrixserverlib"
"github.com/nats-io/nats.go"
)
@ -21,11 +21,11 @@ var js nats.JetStreamContext
var jc *nats.Conn
func TestMain(m *testing.M) {
var pc *process.ProcessContext
pc, js, jc = jetstream.PrepareForTests()
var b *base.BaseDendrite
b, js, jc = test.Base(nil)
code := m.Run()
pc.ShutdownDendrite()
pc.WaitForComponentsToFinish()
b.ShutdownDendrite()
b.WaitForComponentsToFinish()
os.Exit(code)
}

View file

@ -50,7 +50,7 @@ func NewInternalAPI(
logrus.WithError(err).Panicf("failed to connect to room server db")
}
js, nc := jetstream.Prepare(base.ProcessContext, &cfg.Matrix.JetStream)
js, nc := base.NATS.Prepare(base.ProcessContext, &cfg.Matrix.JetStream)
return internal.NewRoomserverAPI(
base.ProcessContext, cfg, roomserverDB, js, nc,