Add debug message to find race-condition

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-06-11 15:32:45 +02:00
parent 1f09c0c0ee
commit bafa9c26f9
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

View File

@ -53,10 +53,16 @@ func (a *autoMessage) CanSend() bool {
case a.Cron != "": case a.Cron != "":
sched, _ := cronParser.Parse(a.Cron) sched, _ := cronParser.Parse(a.Cron)
if sched.Next(a.lastMessageSent).After(time.Now()) { nextExecute := sched.Next(a.lastMessageSent)
if nextExecute.After(time.Now()) {
// Cron timer is not yet expired // Cron timer is not yet expired
return false return false
} }
log.WithFields(log.Fields{
"lastMessage": a.lastMessageSent,
"nextExecution": nextExecute,
"now": time.Now(),
}).Debug("Auto-Message was allowed through cron")
} }
if a.OnlyOnLive { if a.OnlyOnLive {