aboutsummaryrefslogtreecommitdiff
path: root/setup/base/base.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-04-27 15:29:49 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-04-27 15:29:49 +0100
commit923f789ca3174a685bd53ce5e64a5e86cabd38cb (patch)
tree77dedd2028e257e3c1c24f77e19d889189ec38ad /setup/base/base.go
parent103795d33a09728d7619e73014d507505ff121e2 (diff)
Fix graceful shutdown
Diffstat (limited to 'setup/base/base.go')
-rw-r--r--setup/base/base.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/setup/base/base.go b/setup/base/base.go
index 03ea2ad7..e67b034a 100644
--- a/setup/base/base.go
+++ b/setup/base/base.go
@@ -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() {