jaraco / irc

Full-featured Python IRC library for Python.
MIT License
392 stars 87 forks source link

Implementation of exponential backoff and checks for prior connection check scheduling #86

Closed jpbarto closed 8 years ago

jpbarto commented 8 years ago

In response to issue 82 I've inserted a boolean flag which is checked before scheduling a connection check, this is to prevent multiple connection checks from being scheduled and overlapping one another. Additionally I've added a parameter in addition to reconnect_interval of max_reconnect_interval. A user can specify the minimum time to wait (reconnect_interval) and the maximum (max_reconnect_interval). The bot will then perform an exponential backoff within that range.

jaraco commented 8 years ago

Thanks for putting this together. I hadn't even quite realized that the reconnect functionality was happening in the bot module, but it makes sense now. I have a few tweaks I'd like to make, first in supporting Python 3 syntax, but probably also to eliminate output or replace it with logging output; I'll have to see what other parts of the module do. I'm also slightly reluctant to add more parameters to the constructor signature, so I may look for a way to encapsulate the retry functionality. In any case, this PR goes a long way, and I'll use it as a basis for fixing #82.

jaraco commented 8 years ago

I see that the print statements were removed in the subsequent commit, so I retract my comment about Python 3 syntax.