remove jobs.Srv and other jobs-related globals (#7535)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
cb33179998
Коммит
4e79d2d4d0
45
app/app.go
45
app/app.go
@@ -9,6 +9,8 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/mattermost/mattermost-server/einterfaces"
|
||||
ejobs "github.com/mattermost/mattermost-server/einterfaces/jobs"
|
||||
"github.com/mattermost/mattermost-server/jobs"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/plugin/pluginenv"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
@@ -25,6 +27,8 @@ type App struct {
|
||||
Hubs []*Hub
|
||||
HubsStopCheckingForDeadlock chan bool
|
||||
|
||||
Jobs *jobs.JobServer
|
||||
|
||||
AccountMigration einterfaces.AccountMigrationInterface
|
||||
Brand einterfaces.BrandInterface
|
||||
Cluster einterfaces.ClusterInterface
|
||||
@@ -36,7 +40,9 @@ type App struct {
|
||||
Saml einterfaces.SamlInterface
|
||||
}
|
||||
|
||||
var globalApp App
|
||||
var globalApp App = App{
|
||||
Jobs: &jobs.JobServer{},
|
||||
}
|
||||
|
||||
var initEnterprise sync.Once
|
||||
|
||||
@@ -65,6 +71,30 @@ func RegisterComplianceInterface(f func(*App) einterfaces.ComplianceInterface) {
|
||||
complianceInterface = f
|
||||
}
|
||||
|
||||
var jobsDataRetentionInterface func(*App) ejobs.DataRetentionInterface
|
||||
|
||||
func RegisterJobsDataRetentionInterface(f func(*App) ejobs.DataRetentionInterface) {
|
||||
jobsDataRetentionInterface = f
|
||||
}
|
||||
|
||||
var jobsElasticsearchAggregatorInterface func(*App) ejobs.ElasticsearchAggregatorInterface
|
||||
|
||||
func RegisterJobsElasticsearchAggregatorInterface(f func(*App) ejobs.ElasticsearchAggregatorInterface) {
|
||||
jobsElasticsearchAggregatorInterface = f
|
||||
}
|
||||
|
||||
var jobsElasticsearchIndexerInterface func(*App) ejobs.ElasticsearchIndexerInterface
|
||||
|
||||
func RegisterJobsElasticsearchIndexerInterface(f func(*App) ejobs.ElasticsearchIndexerInterface) {
|
||||
jobsElasticsearchIndexerInterface = f
|
||||
}
|
||||
|
||||
var jobsLdapSyncInterface func(*App) ejobs.LdapSyncInterface
|
||||
|
||||
func RegisterJobsLdapSyncInterface(f func(*App) ejobs.LdapSyncInterface) {
|
||||
jobsLdapSyncInterface = f
|
||||
}
|
||||
|
||||
var ldapInterface func(*App) einterfaces.LdapInterface
|
||||
|
||||
func RegisterLdapInterface(f func(*App) einterfaces.LdapInterface) {
|
||||
@@ -121,6 +151,19 @@ func (a *App) initEnterprise() {
|
||||
a.Saml.ConfigureSP()
|
||||
})
|
||||
}
|
||||
|
||||
if jobsDataRetentionInterface != nil {
|
||||
a.Jobs.DataRetention = jobsDataRetentionInterface(a)
|
||||
}
|
||||
if jobsElasticsearchAggregatorInterface != nil {
|
||||
a.Jobs.ElasticsearchAggregator = jobsElasticsearchAggregatorInterface(a)
|
||||
}
|
||||
if jobsElasticsearchIndexerInterface != nil {
|
||||
a.Jobs.ElasticsearchIndexer = jobsElasticsearchIndexerInterface(a)
|
||||
}
|
||||
if jobsLdapSyncInterface != nil {
|
||||
a.Jobs.LdapSync = jobsLdapSyncInterface(a)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) Config() *model.Config {
|
||||
|
||||
Ссылка в новой задаче
Block a user