Ryan Lane has submitted this change and it was merged. Change subject: Make ircecho more resilient to server disconnections. ......................................................................
Make ircecho more resilient to server disconnections. Catch the exception that is thrown when attempting to write to a disconnected server, so that the thread that is handling that write is not terminated. Log the skipped messages on stdout, but do nothing else. Change-Id: If721e402094a62a8c9b069a357b83d163a3f07d0 --- M debian/changelog M ircecho 2 files changed, 15 insertions(+), 1 deletion(-) Approvals: Ryan Lane: Verified; Looks good to me, approved diff --git a/debian/changelog b/debian/changelog index 0b8de50..3c1e8a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ircecho (1.4) hardy-wikimedia; urgency=low + + * Handle exceptions while disconnected from IRC servers. + + -- Ryan Anderson <[email protected]> Mon, 11 Mar 2013 14:37:42 -0700 + ircecho (1.3) hardy-wikimedia; urgency=low * Compiling for hardy diff --git a/ircecho b/ircecho index f757a40..f0317f0 100755 --- a/ircecho +++ b/ircecho @@ -5,6 +5,8 @@ # Written by Kate Turner <[email protected]>, source is in the public domain. # Modified by Ryan Lane <[email protected]> for watching and taking input for files. # Changes are also public domain. +# Modified by Ryan Anderson <[email protected]> to handle +# disconnections more gracefully. Changes in the public domain. import sys import pyinotify @@ -12,6 +14,7 @@ import random import string import re +import irclib # for exceptions. from optparse import OptionParser from ircbot import SingleServerIRCBot @@ -121,9 +124,14 @@ class EventHandler(pyinotify.ProcessEvent): def process_IN_MODIFY(self, event): s = reader.readfile(event.pathname) + s = s.rstrip('\n') if s: chans = reader.getchannels(event.pathname) - bot.connection.privmsg(chans, s) + try: + bot.connection.privmsg(chans, s) + except irclib.ServerNotConnectedError, e: + print ("Error writing: %s\n" + "Dropping this message: '%s'") % (e, s) def process_IN_CREATE(self, event): try: -- To view, visit https://gerrit.wikimedia.org/r/53276 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If721e402094a62a8c9b069a357b83d163a3f07d0 Gerrit-PatchSet: 2 Gerrit-Project: operations/debs/ircecho Gerrit-Branch: master Gerrit-Owner: pugmajere <[email protected]> Gerrit-Reviewer: Ryan Lane <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
