Fix Gerritbot leaking GerritLib Threads.

Gerritbot previously leaked GerritLib threads because it did not check
if the preexisting thread was dead before starting new threads. Fix
that by checking the thread's is_alive() method.

Change-Id: I7282debf5caeb73cbc46b240f10c62b75b683776
This commit is contained in:
Clark Boylan 2012-08-24 13:44:41 -07:00
parent 92b7468921
commit 103f0987d0
1 changed files with 4 additions and 3 deletions

View File

@ -224,9 +224,10 @@ class Gerrit(threading.Thread):
self._read(event)
except:
self.log.exception('Exception encountered in event loop')
# Start new gerrit connection. Don't need to restart IRC bot,
# it will reconnect on its own.
self.connect()
if not self.gerrit.watcher_thread.is_alive():
# Start new gerrit connection. Don't need to restart IRC
# bot, it will reconnect on its own.
self.connected = False
class ChannelConfig(object):