Permalink
Browse files

Eliminate loop in ad-hoc child handler.

Signed-off-by: Jack Miller <jack@codezen.org>
  • Loading branch information...
themoken committed Feb 20, 2013
1 parent 4590451 commit ba5b0a679a72806b87b90bb262ba706e09adfc84
Showing with 5 additions and 0 deletions.
  1. +5 −0 canto_next/storage.py
View
@@ -88,12 +88,17 @@ def _reorganize(self):
sys.exit(0)
log.debug("Reorg forked as %d" % pid)
+ tries = 3
while True:
try:
+ tries -= 1
os.waitpid(pid, 0)
break
except Exception as e:
log.debug("Waiting, got: %s" % e)
+ if tries <= 0:
+ log.debug("Abandoning %d" % pid)
+ break
except Exception as e:
log.warn("Failed to reorganize db:")

0 comments on commit ba5b0a6

Please sign in to comment.