MM-61947 Run DND expiry job more often and round expiry time to match interval (#29938)
* MM-61947 Run DND expiry job more often and round expiry time to match interval * Move comment to make it godoc-compatible * Change truncateDNDEndTime to work with seconds --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e8ef26196c
Коммит
3902d00d0f
@@ -1782,14 +1782,14 @@ func cancelTask(mut *sync.Mutex, taskPointer **model.ScheduledTask) {
|
||||
func runDNDStatusExpireJob(a *App) {
|
||||
if a.IsLeader() {
|
||||
withMut(&a.ch.dndTaskMut, func() {
|
||||
a.ch.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, 5*time.Minute)
|
||||
a.ch.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, model.DNDExpiryInterval)
|
||||
})
|
||||
}
|
||||
a.ch.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() {
|
||||
withMut(&a.ch.dndTaskMut, func() {
|
||||
a.ch.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, 5*time.Minute)
|
||||
a.ch.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, model.DNDExpiryInterval)
|
||||
})
|
||||
} else {
|
||||
cancelTask(&a.ch.dndTaskMut, &a.ch.dndTask)
|
||||
|
||||
Ссылка в новой задаче
Block a user