Mono repo -> Master (#22553)
Combines the following repositories into one: https://github.com/mattermost/mattermost-server https://github.com/mattermost/mattermost-webapp https://github.com/mattermost/focalboard https://github.com/mattermost/mattermost-plugin-playbooks
Этот коммит содержится в:
20
server/channels/jobs/expirynotify/scheduler.go
Обычный файл
20
server/channels/jobs/expirynotify/scheduler.go
Обычный файл
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package expirynotify
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/server/channels/jobs"
|
||||
)
|
||||
|
||||
const schedFreq = 10 * time.Minute
|
||||
|
||||
func MakeScheduler(jobServer *jobs.JobServer) model.Scheduler {
|
||||
isEnabled := func(cfg *model.Config) bool {
|
||||
return *cfg.ServiceSettings.ExtendSessionLengthWithActivity
|
||||
}
|
||||
return jobs.NewPeriodicScheduler(jobServer, model.JobTypeExpiryNotify, schedFreq, isEnabled)
|
||||
}
|
||||
25
server/channels/jobs/expirynotify/worker.go
Обычный файл
25
server/channels/jobs/expirynotify/worker.go
Обычный файл
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package expirynotify
|
||||
|
||||
import (
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/server/channels/jobs"
|
||||
)
|
||||
|
||||
const (
|
||||
JobName = "ExpiryNotify"
|
||||
)
|
||||
|
||||
func MakeWorker(jobServer *jobs.JobServer, notifySessionsExpired func() error) model.Worker {
|
||||
isEnabled := func(cfg *model.Config) bool {
|
||||
return *cfg.ServiceSettings.ExtendSessionLengthWithActivity
|
||||
}
|
||||
execute := func(job *model.Job) error {
|
||||
defer jobServer.HandleJobPanic(job)
|
||||
|
||||
return notifySessionsExpired()
|
||||
}
|
||||
return jobs.NewSimpleWorker(JobName, jobServer, execute, isEnabled)
|
||||
}
|
||||
Ссылка в новой задаче
Block a user