mirror of
https://github.com/element-hq/dendrite.git
synced 2025-03-14 14:15:35 +00:00
Tweak NATS startup and readiness checking (#3523)
Signed-off-by: Neil Alexander <git@neilalexander.dev> Signed-off-by: Neil Alexander <git@neilalexander.dev> Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This commit is contained in:
parent
ad22d950dd
commit
06e25ca5ca
1 changed files with 8 additions and 5 deletions
|
@ -66,10 +66,8 @@ func (s *NATSInstance) Prepare(process *process.ProcessContext, cfg *config.JetS
|
|||
if !cfg.NoLog {
|
||||
s.SetLogger(NewLogAdapter(), opts.Debug, opts.Trace)
|
||||
}
|
||||
go func() {
|
||||
process.ComponentStarted()
|
||||
s.Start()
|
||||
}()
|
||||
process.ComponentStarted()
|
||||
go s.Start()
|
||||
go func() {
|
||||
<-process.WaitForShutdown()
|
||||
s.Shutdown()
|
||||
|
@ -77,7 +75,12 @@ func (s *NATSInstance) Prepare(process *process.ProcessContext, cfg *config.JetS
|
|||
process.ComponentFinished()
|
||||
}()
|
||||
if !s.ReadyForConnections(time.Second * 60) {
|
||||
logrus.Fatalln("NATS did not start in time")
|
||||
logrus.Fatalln("NATS did not start in time, shutting down")
|
||||
process.ShutdownDendrite()
|
||||
s.Shutdown()
|
||||
s.WaitForShutdown()
|
||||
process.ComponentFinished()
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue