mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +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
1 changed files with 7 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue