summaryrefslogtreecommitdiffstats
path: root/cmd/mattermost/commands/jobserver.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/mattermost/commands/jobserver.go')
-rw-r--r--cmd/mattermost/commands/jobserver.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd/mattermost/commands/jobserver.go b/cmd/mattermost/commands/jobserver.go
index 43a21d61f..253ada932 100644
--- a/cmd/mattermost/commands/jobserver.go
+++ b/cmd/mattermost/commands/jobserver.go
@@ -41,11 +41,15 @@ func jobserverCmdF(command *cobra.Command, args []string) {
// Run jobs
mlog.Info("Starting Mattermost job server")
+ defer mlog.Info("Stopped Mattermost job server")
+
if !noJobs {
a.Jobs.StartWorkers()
+ defer a.Jobs.StopWorkers()
}
if !noSchedule {
a.Jobs.StartSchedulers()
+ defer a.Jobs.StopSchedulers()
}
signalChan := make(chan os.Signal, 1)
@@ -54,9 +58,4 @@ func jobserverCmdF(command *cobra.Command, args []string) {
// Cleanup anything that isn't handled by a defer statement
mlog.Info("Stopping Mattermost job server")
-
- a.Jobs.StopSchedulers()
- a.Jobs.StopWorkers()
-
- mlog.Info("Stopped Mattermost job server")
}