Make sure NATS uses own persistent directory (TODO: make this configurable)

This commit is contained in:
Neil Alexander 2021-07-14 10:23:04 +01:00
parent e2d562257c
commit beb2ddf03d
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
5 changed files with 10 additions and 4 deletions

View file

@ -37,6 +37,7 @@ func SetupConsumerProducer(cfg *config.Kafka) (sarama.Consumer, sarama.SyncProdu
ServerName: "monolith",
DontListen: true,
JetStream: true,
StoreDir: string(cfg.Matrix.ServerName),
LogFile: "nats.log",
Debug: true,
})
@ -48,7 +49,9 @@ func SetupConsumerProducer(cfg *config.Kafka) (sarama.Consumer, sarama.SyncProdu
s = natsServer
}
natsServerMutex.Unlock()
natsServer.WaitForStartup()
if !natsServer.ReadyForConnections(time.Second * 10) {
logrus.Fatalln("NATS did not start in time")
}
conn, err := s.InProcessConn()
if err != nil {
logrus.Fatalln("Failed to get a NATS in-process conn")