Fix graceful shutdown

This commit is contained in:
Neil Alexander 2022-04-27 15:29:49 +01:00
parent 103795d33a
commit 923f789ca3
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 33 additions and 21 deletions

View file

@ -469,14 +469,14 @@ func (b *BaseDendrite) SetupAndServeHTTP(
}
minwinsvc.SetOnExit(b.ProcessContext.ShutdownDendrite)
b.WaitForShutdown()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_ = internalServ.Shutdown(ctx)
_ = externalServ.Shutdown(ctx)
<-b.ProcessContext.WaitForShutdown()
logrus.Infof("Stopping HTTP listeners")
_ = internalServ.Shutdown(context.Background())
_ = externalServ.Shutdown(context.Background())
logrus.Infof("Stopped HTTP listeners")
b.WaitForShutdown()
}
func (b *BaseDendrite) WaitForShutdown() {