-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorter end of election rescrape interval #82
Conversation
return; | ||
} | ||
|
||
// After rescraping, the election is over but we do not have winners yet | ||
else if(election.phase === 'ended' && !election.arrWinners.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting for myself - should probably abstract this away into a hasWinners() : boolean
instance method on the Election
class
else if (election.phase === 'ended' && election.prev.arrWinners.length != election.arrWinners.length && election.arrWinners.length > 0) { | ||
await announceWinners(election); | ||
|
||
// No more need to scrape the election or greet the room | ||
BotConfig.scrapeIntervalMins = 999999; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 What do you think of making it -1
instead, though? 999999
makes me a little uncomfortable (like the z-index
inflation) that it's actually possible to happen under some unstable condition. Not sure it it's worth thinking about, though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced a negative number will work https://stackoverflow.com/q/8430966
We could even set it back to the default of 10 mins and it will be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry, I was unclear about what I mean - I didn't want to make it -1
and then pass that unconditionally to setTimeout
but rather make it a special value that is then guarded against before setting the timeout. It would also be idiomatic since lastMessageTime
also uses -1
as a special value. In any case, this is just a note that we could maybe think about after more pressing matters
#74 - Bot should rescrape election page for winners during election end
Added cancel cron jobs if election dates were changed. Still need to create a function to check date changes (#80)