This reverts commit 77d42568f9.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e1b13c10fc
Коммит
ff383990f8
@@ -205,9 +205,6 @@ type Server struct {
|
||||
featureFlagStop chan struct{}
|
||||
featureFlagStopped chan struct{}
|
||||
featureFlagSynchronizerMutex sync.Mutex
|
||||
|
||||
dndnTaskMut sync.Mutex
|
||||
dndTask *model.ScheduledTask
|
||||
}
|
||||
|
||||
func NewServer(options ...Option) (*Server, error) {
|
||||
@@ -668,7 +665,6 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
s.runLicenseExpirationCheckJob()
|
||||
runCheckAdminSupportStatusJob(fakeApp, c)
|
||||
runCheckWarnMetricStatusJob(fakeApp, c)
|
||||
runDNDStatusExpireJob(fakeApp)
|
||||
})
|
||||
s.runJobs()
|
||||
}
|
||||
@@ -1047,12 +1043,6 @@ func (s *Server) Shutdown() {
|
||||
mlog.Warn("Error flushing logs", mlog.Err(err))
|
||||
}
|
||||
|
||||
s.dndnTaskMut.Lock()
|
||||
if s.dndTask != nil {
|
||||
s.dndTask.Cancel()
|
||||
}
|
||||
s.dndnTaskMut.Unlock()
|
||||
|
||||
mlog.Info("Server stopped")
|
||||
|
||||
// this should just write the "server stopped" record, the rest are already flushed.
|
||||
@@ -2286,26 +2276,3 @@ func (s *Server) ReadFile(path string) ([]byte, *model.AppError) {
|
||||
// }
|
||||
// return result, nil
|
||||
// }
|
||||
|
||||
func runDNDStatusExpireJob(a *App) {
|
||||
if a.IsLeader() {
|
||||
a.srv.dndnTaskMut.Lock()
|
||||
a.srv.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, 5*time.Minute)
|
||||
a.srv.dndnTaskMut.Unlock()
|
||||
}
|
||||
a.srv.AddClusterLeaderChangedListener(func() {
|
||||
mlog.Info("Cluster leader changed. Determining if unset DNS status task should be running", mlog.Bool("isLeader", a.IsLeader()))
|
||||
if a.IsLeader() {
|
||||
a.srv.dndnTaskMut.Lock()
|
||||
a.srv.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, 5*time.Minute)
|
||||
a.srv.dndnTaskMut.Unlock()
|
||||
} else {
|
||||
a.srv.dndnTaskMut.Lock()
|
||||
if a.srv.dndTask != nil {
|
||||
a.srv.dndTask.Cancel()
|
||||
a.srv.dndTask = nil
|
||||
}
|
||||
a.srv.dndnTaskMut.Unlock()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user