mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-09-19 18:12:55 +00:00
Add debug message to find race-condition
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
1f09c0c0ee
commit
bafa9c26f9
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user