mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Added debug log to indicate the job is not running as the node is not a leader node (#34701)
* Added debug log to indicate the job is not running as the node is not cluster node * Setting log level to info for debugging test server issue * testing * Removed debugging code --------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
bbac501431
commit
7c94aed6ba
1 changed files with 11 additions and 1 deletions
|
|
@ -1773,7 +1773,10 @@ func runDNDStatusExpireJob(a *App) {
|
|||
withMut(&a.ch.dndTaskMut, func() {
|
||||
a.ch.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, model.DNDExpiryInterval)
|
||||
})
|
||||
} else {
|
||||
mlog.Debug("Skipping unset DND status job startup since this is not the leader node")
|
||||
}
|
||||
|
||||
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() {
|
||||
|
|
@ -1781,6 +1784,7 @@ func runDNDStatusExpireJob(a *App) {
|
|||
a.ch.dndTask = model.CreateRecurringTaskFromNextIntervalTime("Unset DND Statuses", a.UpdateDNDStatusOfUsers, model.DNDExpiryInterval)
|
||||
})
|
||||
} else {
|
||||
mlog.Debug("This is no longer leader node. Cancelling the unset DND status task", mlog.Bool("isLeader", a.IsLeader()))
|
||||
cancelTask(&a.ch.dndTaskMut, &a.ch.dndTask)
|
||||
}
|
||||
})
|
||||
|
|
@ -1793,7 +1797,10 @@ func runPostReminderJob(a *App) {
|
|||
fn := func() { a.CheckPostReminders(rctx) }
|
||||
a.ch.postReminderTask = model.CreateRecurringTaskFromNextIntervalTime("Check Post reminders", fn, 5*time.Minute)
|
||||
})
|
||||
} else {
|
||||
mlog.Debug("Skipping post reminder job startup since this is not the leader node")
|
||||
}
|
||||
|
||||
a.ch.srv.AddClusterLeaderChangedListener(func() {
|
||||
mlog.Info("Cluster leader changed. Determining if post reminder task should be running", mlog.Bool("isLeader", a.IsLeader()))
|
||||
if a.IsLeader() {
|
||||
|
|
@ -1803,6 +1810,7 @@ func runPostReminderJob(a *App) {
|
|||
a.ch.postReminderTask = model.CreateRecurringTaskFromNextIntervalTime("Check Post reminders", fn, 5*time.Minute)
|
||||
})
|
||||
} else {
|
||||
mlog.Debug("This is no longer leader node. Cancelling the post reminder task", mlog.Bool("isLeader", a.IsLeader()))
|
||||
cancelTask(&a.ch.postReminderMut, &a.ch.postReminderTask)
|
||||
}
|
||||
})
|
||||
|
|
@ -1811,6 +1819,8 @@ func runPostReminderJob(a *App) {
|
|||
func runScheduledPostJob(a *App) {
|
||||
if a.IsLeader() {
|
||||
doRunScheduledPostJob(a)
|
||||
} else {
|
||||
mlog.Debug("Skipping scheduled posts job startup since this is not the leader node")
|
||||
}
|
||||
|
||||
a.ch.srv.AddClusterLeaderChangedListener(func() {
|
||||
|
|
@ -1818,7 +1828,7 @@ func runScheduledPostJob(a *App) {
|
|||
if a.IsLeader() {
|
||||
doRunScheduledPostJob(a)
|
||||
} else {
|
||||
mlog.Info("This is no longer leader node. Cancelling the scheduled post task", mlog.Bool("isLeader", a.IsLeader()))
|
||||
mlog.Debug("This is no longer leader node. Cancelling the scheduled post task", mlog.Bool("isLeader", a.IsLeader()))
|
||||
cancelTask(&a.ch.scheduledPostMut, &a.ch.scheduledPostTask)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue