mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 09:43:10 -06:00
Fix namespacing
This commit is contained in:
parent
8c20a7f7ce
commit
9e341501b2
|
|
@ -74,14 +74,22 @@ func setupNATS(cfg *config.JetStream, nc *natsclient.Conn) (nats.JetStreamContex
|
|||
logrus.WithError(err).Fatal("Unable to get stream info")
|
||||
}
|
||||
if info == nil {
|
||||
stream.Subjects = []string{name}
|
||||
// Define a default subject if not already specified.
|
||||
if len(stream.Subjects) == 0 {
|
||||
stream.Subjects = []string{name}
|
||||
}
|
||||
|
||||
// If we're trying to keep everything in memory (e.g. unit tests)
|
||||
// then overwrite the storage policy.
|
||||
if cfg.InMemory {
|
||||
stream.Storage = nats.MemoryStorage
|
||||
}
|
||||
|
||||
if _, err = s.AddStream(stream); err != nil {
|
||||
// Namespace the streams without modifying the original streams
|
||||
// array, otherwise we end up with namespaces on namespaces.
|
||||
namespaced := *stream
|
||||
namespaced.Name = name
|
||||
if _, err = s.AddStream(&namespaced); err != nil {
|
||||
logrus.WithError(err).WithField("stream", name).Fatal("Unable to add stream")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue