marvin
marvin copied to clipboard
Reconnect is fragile
It looks like when a DNS query fails, the bot just gives up reconnecting forever:
[WARN] Adding timer to reconnect to irc.freenode.net:6667 in 15 seconds
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:714:in `connect_server': unable to resolve server address (EventMachine::ConnectionError)
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:714:in `bind_connect'
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:692:in `connect'
from /usr/lib/ruby/gems/1.8/gems/marvin-0.8.2/bin/../lib/marvin/irc/client.rb:129:in `connect'
from /usr/lib/ruby/gems/1.8/gems/marvin-0.8.2/bin/../lib/marvin/irc/client.rb:146:in `add_reconnect'
There are probably a lot of different ways a connect can throw exceptions, so a simple workaround would be: 5.times { begin; <connect>; rescue; sleep 15; end }