From bafa9c26f9cd2992eb71f725f5ce3cea5629d9b4 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 11 Jun 2021 15:32:45 +0200 Subject: [PATCH] Add debug message to find race-condition Signed-off-by: Knut Ahlers --- automessage.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/automessage.go b/automessage.go index 456e9b9..077328b 100644 --- a/automessage.go +++ b/automessage.go @@ -53,10 +53,16 @@ func (a *autoMessage) CanSend() bool { case 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 return false } + log.WithFields(log.Fields{ + "lastMessage": a.lastMessageSent, + "nextExecution": nextExecute, + "now": time.Now(), + }).Debug("Auto-Message was allowed through cron") } if a.OnlyOnLive {