You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since bot.listen uses long polling, read timeouts are to be expected when there's no activity.
In that regard, this should be hidden from the user of the library and poll request automatically restarted.
Was expecting this behaviour initially, and learned it wasn't, the hard way — bot crashed when nobody was looking at it and it stayed down for 8 hours until I woke up to see the Net::ReadTimeout got thrown from bot.listen.
To make my bot persistent, I had to update the main loop to look like this:
whiletruebeginbot.listendo |message|
logfrommessagecasemessage.textwhen/^\/pony\b/derpibooru_bot.pony(message)when/^\/(start|help)\b/derpibooru_bot.sendtext(message,"Hello! I'm a bot by @hmage ...")endendrescueNet::ReadTimeout=>elogerroreendend
If adding automatic restart is not an option, update all examples to handle Net::ReadTimeout exception, because it will happen after a while when bot is supposed to be 24/7.
The text was updated successfully, but these errors were encountered:
Since
bot.listen
uses long polling, read timeouts are to be expected when there's no activity.In that regard, this should be hidden from the user of the library and poll request automatically restarted.
Was expecting this behaviour initially, and learned it wasn't, the hard way — bot crashed when nobody was looking at it and it stayed down for 8 hours until I woke up to see the
Net::ReadTimeout
got thrown frombot.listen
.To make my bot persistent, I had to update the main loop to look like this:
If adding automatic restart is not an option, update all examples to handle
Net::ReadTimeout
exception, because it will happen after a while when bot is supposed to be 24/7.The text was updated successfully, but these errors were encountered: