Files
mattermost/jobs/server.go
Doug Lauder b317ee5cf2 MM-25394 session expired push notifications (#14732)
* new job type created that checks for expired mobile sessions and pushes notifications.

* only send session expired notifications if ExtendSessionLengthWithActivity is enabled.

* includes schema change:  field added to Sessions table
2020-06-17 14:47:54 -04:00

61 lines
1.7 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
ejobs "github.com/mattermost/mattermost-server/v5/einterfaces/jobs"
tjobs "github.com/mattermost/mattermost-server/v5/jobs/interfaces"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/configservice"
"github.com/mattermost/mattermost-server/v5/store"
)
type JobServer struct {
ConfigService configservice.ConfigService
Store store.Store
Workers *Workers
Schedulers *Schedulers
DataRetentionJob ejobs.DataRetentionJobInterface
MessageExportJob ejobs.MessageExportJobInterface
ElasticsearchAggregator ejobs.ElasticsearchAggregatorInterface
ElasticsearchIndexer tjobs.IndexerJobInterface
LdapSync ejobs.LdapSyncInterface
Migrations tjobs.MigrationsJobInterface
Plugins tjobs.PluginsJobInterface
BleveIndexer tjobs.IndexerJobInterface
ExpiryNotify tjobs.ExpiryNotifyJobInterface
}
func NewJobServer(configService configservice.ConfigService, store store.Store) *JobServer {
return &JobServer{
ConfigService: configService,
Store: store,
}
}
func (srv *JobServer) Config() *model.Config {
return srv.ConfigService.Config()
}
func (srv *JobServer) StartWorkers() {
srv.Workers = srv.Workers.Start()
}
func (srv *JobServer) StartSchedulers() {
srv.Schedulers = srv.Schedulers.Start()
}
func (srv *JobServer) StopWorkers() {
if srv.Workers != nil {
srv.Workers.Stop()
}
}
func (srv *JobServer) StopSchedulers() {
if srv.Schedulers != nil {
srv.Schedulers.Stop()
}
}