diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/platform/server.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/platform/server.go b/cmd/platform/server.go index e36abdaf9..0c23b5f27 100644 --- a/cmd/platform/server.go +++ b/cmd/platform/server.go @@ -21,6 +21,10 @@ import ( "github.com/spf13/cobra" ) +const ( + SESSIONS_CLEANUP_BATCH_SIZE = 1000 +) + var MaxNotificationsPerChannelDefault int64 = 1000000 var serverCmd = &cobra.Command{ @@ -120,7 +124,7 @@ func runServer(configFileLocation string, disableConfigWatch bool) { go runSecurityJob(a) go runDiagnosticsJob(a) - + go runSessionCleanupJob(a) go runTokenCleanupJob(a) go runCommandWebhookCleanupJob(a) @@ -198,6 +202,13 @@ func runCommandWebhookCleanupJob(a *app.App) { }, time.Hour*1) } +func runSessionCleanupJob(a *app.App) { + doSessionCleanup(a) + model.CreateRecurringTask("Session Cleanup", func() { + doSessionCleanup(a) + }, time.Hour*24) +} + func resetStatuses(a *app.App) { if result := <-a.Srv.Store.Status().ResetAll(); result.Err != nil { l4g.Error(utils.T("mattermost.reset_status.error"), result.Err.Error()) @@ -221,3 +232,7 @@ func doTokenCleanup(a *app.App) { func doCommandWebhookCleanup(a *app.App) { a.Srv.Store.CommandWebhook().Cleanup() } + +func doSessionCleanup(a *app.App) { + a.Srv.Store.Session().Cleanup(model.GetMillis(), SESSIONS_CLEANUP_BATCH_SIZE) +} |