summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPierre de La Morinerie <kemenaran@gmail.com>2018-02-14 23:48:06 +0530
committerChris <ccbrown112@gmail.com>2018-02-14 12:18:06 -0600
commit44a27125de1b4658f1149f5bc459468a056b4d7d (patch)
tree4ddd20763c3a551b25ffcebf104c960bddd66083 /cmd
parentcafa4e4370c4d8bfa1cdbfbf8b74387b4fbee257 (diff)
downloadchat-44a27125de1b4658f1149f5bc459468a056b4d7d.tar.gz
chat-44a27125de1b4658f1149f5bc459468a056b4d7d.tar.bz2
chat-44a27125de1b4658f1149f5bc459468a056b4d7d.zip
Wait for goroutines to finish before shuting down server (#8259)
When running server tests, the server will exit while some jobs spawned through a goroutine are still running. This may crash the test harness, as the jobs try to access a shut down app instance. Fortunately the fix is easy: we just have to use the same App goroutine-counting facility than the rest of the method's goroutines.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/platform/server.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/cmd/platform/server.go b/cmd/platform/server.go
index 1b411cf20..80b38401e 100644
--- a/cmd/platform/server.go
+++ b/cmd/platform/server.go
@@ -130,11 +130,21 @@ func runServer(configFileLocation string, disableConfigWatch bool, interruptChan
a.EnsureDiagnosticId()
- go runSecurityJob(a)
- go runDiagnosticsJob(a)
- go runSessionCleanupJob(a)
- go runTokenCleanupJob(a)
- go runCommandWebhookCleanupJob(a)
+ a.Go(func() {
+ runSecurityJob(a)
+ })
+ a.Go(func() {
+ runDiagnosticsJob(a)
+ })
+ a.Go(func() {
+ runSessionCleanupJob(a)
+ })
+ a.Go(func() {
+ runTokenCleanupJob(a)
+ })
+ a.Go(func() {
+ runCommandWebhookCleanupJob(a)
+ })
if complianceI := a.Compliance; complianceI != nil {
complianceI.StartComplianceDailyJob()