github.com/adacta-ru/mattermost-server/v5@v5.31.1/jobs/server.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package jobs 5 6 import ( 7 ejobs "github.com/adacta-ru/mattermost-server/v5/einterfaces/jobs" 8 tjobs "github.com/adacta-ru/mattermost-server/v5/jobs/interfaces" 9 "github.com/adacta-ru/mattermost-server/v5/model" 10 "github.com/adacta-ru/mattermost-server/v5/services/configservice" 11 "github.com/adacta-ru/mattermost-server/v5/store" 12 ) 13 14 type JobServer struct { 15 ConfigService configservice.ConfigService 16 Store store.Store 17 Workers *Workers 18 Schedulers *Schedulers 19 20 DataRetentionJob ejobs.DataRetentionJobInterface 21 MessageExportJob ejobs.MessageExportJobInterface 22 ElasticsearchAggregator ejobs.ElasticsearchAggregatorInterface 23 ElasticsearchIndexer tjobs.IndexerJobInterface 24 LdapSync ejobs.LdapSyncInterface 25 Migrations tjobs.MigrationsJobInterface 26 Plugins tjobs.PluginsJobInterface 27 BleveIndexer tjobs.IndexerJobInterface 28 ExpiryNotify tjobs.ExpiryNotifyJobInterface 29 ProductNotices tjobs.ProductNoticesJobInterface 30 ActiveUsers tjobs.ActiveUsersJobInterface 31 ImportProcess tjobs.ImportProcessInterface 32 Cloud ejobs.CloudJobInterface 33 } 34 35 func NewJobServer(configService configservice.ConfigService, store store.Store) *JobServer { 36 return &JobServer{ 37 ConfigService: configService, 38 Store: store, 39 } 40 } 41 42 func (srv *JobServer) Config() *model.Config { 43 return srv.ConfigService.Config() 44 } 45 46 func (srv *JobServer) StartWorkers() { 47 srv.Workers = srv.Workers.Start() 48 } 49 50 func (srv *JobServer) StartSchedulers() { 51 srv.Schedulers = srv.Schedulers.Start() 52 } 53 54 func (srv *JobServer) StopWorkers() { 55 if srv.Workers != nil { 56 srv.Workers.Stop() 57 } 58 } 59 60 func (srv *JobServer) StopSchedulers() { 61 if srv.Schedulers != nil { 62 srv.Schedulers.Stop() 63 } 64 }