auto reconnect for handling connection problems cf #3202

Quentin Gibeaux 4 years ago committed by root
parent e5d1d76a7d
commit 5f0d1c435b
  1. 3

@ -256,10 +256,13 @@ def main():
ready_to_read, b, c =[ircsock],[],[], 1) # b&c are ignored here
process_newcomers(WelcomeBot, [i for i in WelcomeBot.newcomers if i.around_for() > WelcomeBot.wait_time], ircsock,, settings.channel_greeters)
if ready_to_read:
last_read = datetime.datetime.utcnow()
ircmsg = msg_handler(ircsock) # gets message from ircsock
ircmsg, actor = parse_messages(ircmsg) # parses it or returns None
if ircmsg is not None: # If we were able to parse it
message_response(WelcomeBot, ircmsg, actor, ircsock,, settings.channel_greeters) # Respond to the parsed message
if datetime.datetime.utcnow() - last_read > datetime.timedelta(minutes=10):
raise Exception('timeout: nothing to read on socket since 10 minutes')
if __name__ == "__main__": # This line tells the interpreter to only execute main() if the program is being run, not imported.