Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix trim failure.

Sometimes the database is unavailable, keep the workaround forked process from
crapping out and missing sys.exit and ending up back in the parent's code.

Signed-off-by: Jack Miller <jack@codezen.org>
  • Loading branch information...
commit c10ff50a2a09dd2ee8bed753756b1a1ab195742c 1 parent cef0fe8
@themoken authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 canto_next/storage.py
View
15 canto_next/storage.py
@@ -81,10 +81,17 @@ def _reorganize(self):
pid = os.fork()
if not pid:
- db = dbm.open(self.filename, "w")
- getattr(db, 'reorganize')()
- log.debug("Reorged - dying\n")
- db.close()
+
+ # Wrap everything to make sure we don't get back into the
+ # primary server code.
+
+ try:
+ db = dbm.open(self.filename, "w")
+ getattr(db, 'reorganize')()
+ log.debug("Reorged - dying\n")
+ db.close()
+ except:
+ pass
sys.exit(0)
log.debug("Reorg forked as %d" % pid)
Please sign in to comment.
Something went wrong with that request. Please try again.