Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from Nextdoor/kill_znode_on_term
Browse files Browse the repository at this point in the history
Bugfix on SIGTERM work ... now wait for paths to update before exiting.
  • Loading branch information
diranged committed Feb 10, 2016
2 parents 28496c2 + 6bfffde commit 9dc52ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,5 @@ zk_watcher \
echo $! > /pidfile

while true; do
echo "Weee"
wait %1
echo "waiting"
done
6 changes: 5 additions & 1 deletion zk_watcher/zk_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,17 @@ def run(self):
self._event.wait(1)

self._update(False)
self.log.info('Deregistering %s' % self._fullpath)
self._sr.unset(self._fullpath)
self._sr = None
self.log.debug('Watcher %s is exiting the run() loop.' % self._service)
self.log.info('Watcher %s is exiting the run() loop.' % self._service)

def stop(self):
"""Stop the run() loop."""
self._event.set()
self.log.debug("Waiting for run() loop to exit.")
while self._sr is not None:
self._event.wait(1)

def _update(self, state):
# Call ServiceRegistry.set() method with our state, data,
Expand Down

0 comments on commit 9dc52ab

Please sign in to comment.