Remove enable plugin health check config option (#11369)
Этот коммит содержится в:
коммит произвёл
Lev
родитель
30d572000a
Коммит
4e5f6fcfbc
@@ -586,7 +586,6 @@ func (a *App) trackConfig() {
|
|||||||
"enable_zoom": pluginActivated(cfg.PluginSettings.PluginStates, "zoom"),
|
"enable_zoom": pluginActivated(cfg.PluginSettings.PluginStates, "zoom"),
|
||||||
"enable": *cfg.PluginSettings.Enable,
|
"enable": *cfg.PluginSettings.Enable,
|
||||||
"enable_uploads": *cfg.PluginSettings.EnableUploads,
|
"enable_uploads": *cfg.PluginSettings.EnableUploads,
|
||||||
"enable_health_check": *cfg.PluginSettings.EnableHealthCheck,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
a.SendDiagnostic(TRACK_CONFIG_DATA_RETENTION, map[string]interface{}{
|
a.SendDiagnostic(TRACK_CONFIG_DATA_RETENTION, map[string]interface{}{
|
||||||
|
|||||||
@@ -201,14 +201,8 @@ func NewServer(options ...Option) (*Server, error) {
|
|||||||
// Start plugin health check job
|
// Start plugin health check job
|
||||||
pluginsEnvironment := s.PluginsEnvironment
|
pluginsEnvironment := s.PluginsEnvironment
|
||||||
if pluginsEnvironment != nil {
|
if pluginsEnvironment != nil {
|
||||||
pluginsEnvironment.InitPluginHealthCheckJob(*s.Config().PluginSettings.EnableHealthCheck)
|
pluginsEnvironment.InitPluginHealthCheckJob()
|
||||||
}
|
}
|
||||||
s.AddConfigListener(func(_, c *model.Config) {
|
|
||||||
pluginsEnvironment := s.PluginsEnvironment
|
|
||||||
if pluginsEnvironment != nil {
|
|
||||||
pluginsEnvironment.InitPluginHealthCheckJob(*c.PluginSettings.EnableHealthCheck)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
mlog.Info(fmt.Sprintf("Current version is %v (%v/%v/%v/%v)", model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise))
|
mlog.Info(fmt.Sprintf("Current version is %v (%v/%v/%v/%v)", model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise))
|
||||||
mlog.Info(fmt.Sprintf("Enterprise Enabled: %v", model.BuildEnterpriseReady))
|
mlog.Info(fmt.Sprintf("Enterprise Enabled: %v", model.BuildEnterpriseReady))
|
||||||
|
|||||||
@@ -2173,13 +2173,12 @@ type PluginState struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PluginSettings struct {
|
type PluginSettings struct {
|
||||||
Enable *bool
|
Enable *bool
|
||||||
EnableUploads *bool `restricted:"true"`
|
EnableUploads *bool `restricted:"true"`
|
||||||
EnableHealthCheck *bool `restricted:"true"`
|
Directory *string `restricted:"true"`
|
||||||
Directory *string `restricted:"true"`
|
ClientDirectory *string `restricted:"true"`
|
||||||
ClientDirectory *string `restricted:"true"`
|
Plugins map[string]map[string]interface{}
|
||||||
Plugins map[string]map[string]interface{}
|
PluginStates map[string]*PluginState
|
||||||
PluginStates map[string]*PluginState
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||||
@@ -2191,10 +2190,6 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
|||||||
s.EnableUploads = NewBool(false)
|
s.EnableUploads = NewBool(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.EnableHealthCheck == nil {
|
|
||||||
s.EnableHealthCheck = NewBool(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if s.Directory == nil {
|
if s.Directory == nil {
|
||||||
s.Directory = NewString(PLUGIN_SETTINGS_DEFAULT_DIRECTORY)
|
s.Directory = NewString(PLUGIN_SETTINGS_DEFAULT_DIRECTORY)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,20 +29,11 @@ type PluginHealthStatus struct {
|
|||||||
lastError error
|
lastError error
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitPluginHealthCheckJob starts a new job if one is not running and is set to enabled, or kills an existing one if set to disabled.
|
// InitPluginHealthCheckJob starts a new job for checking all active plugins
|
||||||
func (env *Environment) InitPluginHealthCheckJob(enable bool) {
|
func (env *Environment) InitPluginHealthCheckJob() {
|
||||||
// Config is set to enable. No job exists, start a new job.
|
job := newPluginHealthCheckJob(env)
|
||||||
if enable && env.pluginHealthCheckJob == nil {
|
env.pluginHealthCheckJob = job
|
||||||
job := newPluginHealthCheckJob(env)
|
job.Start()
|
||||||
env.pluginHealthCheckJob = job
|
|
||||||
job.Start()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Config is set to disable. Job exists, kill existing job.
|
|
||||||
if !enable && env.pluginHealthCheckJob != nil {
|
|
||||||
env.pluginHealthCheckJob.Cancel()
|
|
||||||
env.pluginHealthCheckJob = nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start continuously runs health checks on all active plugins, on a timer.
|
// Start continuously runs health checks on all active plugins, on a timer.
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user