Skip to content

Commit

Permalink
Track the status of the gerritChangeSource process
Browse files Browse the repository at this point in the history
separately from self.parent, which does not mean 'running'

Fixes #2208.
  • Loading branch information
djmitche committed Feb 21, 2012
1 parent 853b703 commit 097fedf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions master/buildbot/changes/gerritchangesource.py
Expand Up @@ -62,6 +62,7 @@ def __init__(self, gerritserver, username, gerritport=29418, identity_file=None)
self.username = username
self.identity_file = identity_file
self.process = None
self.wantProcess = False
self.streamProcessTimeout = self.STREAM_BACKOFF_MIN

class LocalPP(ProcessProtocol):
Expand Down Expand Up @@ -151,8 +152,8 @@ def eventReceived_ref_updated(self, properties, event):
def streamProcessStopped(self):
self.process = None

# if the service is stopped, don't try to restart
if not self.parent:
# if the service is stopped, don't try to restart the process
if not self.wantProcess:
log.msg("service is not running; not reconnecting")
return

Expand Down Expand Up @@ -181,9 +182,11 @@ def startStreamProcess(self):
[ "ssh" ] + args + [ "gerrit", "stream-events" ])

def startService(self):
self.wantProcess = True
self.startStreamProcess()

def stopService(self):
self.wantProcess = False
if self.process:
self.process.signalProcess("KILL")
# TODO: if this occurs while the process is restarting, some exceptions may
Expand Down

0 comments on commit 097fedf

Please sign in to comment.