summaryrefslogtreecommitdiffstats
path: root/cmd/mattermost/commands/server.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-08-09 05:04:49 -0400
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-08-09 11:04:49 +0200
commit7649488a268f74c21524ab440411eac0a35b26e2 (patch)
tree8abdeeea9ffc1fce97e42709dd78dd2213da0330 /cmd/mattermost/commands/server.go
parent5fbec91c35d7ea5d9b920b26a01fc21da55bb08e (diff)
downloadchat-7649488a268f74c21524ab440411eac0a35b26e2.tar.gz
chat-7649488a268f74c21524ab440411eac0a35b26e2.tar.bz2
chat-7649488a268f74c21524ab440411eac0a35b26e2.zip
MM-11637: avoid stopping unstarted jobs (#9240)
The new locking primitives in 5.2 around jobs assume the worker/scheduler was actually started, so don't try to stop if not started.
Diffstat (limited to 'cmd/mattermost/commands/server.go')
-rw-r--r--cmd/mattermost/commands/server.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/cmd/mattermost/commands/server.go b/cmd/mattermost/commands/server.go
index 1c33505f5..0b7ef009c 100644
--- a/cmd/mattermost/commands/server.go
+++ b/cmd/mattermost/commands/server.go
@@ -181,9 +181,11 @@ func runServer(configFileLocation string, disableConfigWatch bool, usedPlatform
if *a.Config().JobSettings.RunJobs {
a.Jobs.StartWorkers()
+ defer a.Jobs.StopWorkers()
}
if *a.Config().JobSettings.RunScheduler {
a.Jobs.StartSchedulers()
+ defer a.Jobs.StopSchedulers()
}
notifyReady()
@@ -201,9 +203,6 @@ func runServer(configFileLocation string, disableConfigWatch bool, usedPlatform
a.Metrics.StopServer()
}
- a.Jobs.StopSchedulers()
- a.Jobs.StopWorkers()
-
return nil
}