Merge lp:~cmiller/desktopcouch/retry-on-couchdb-death-bug530541 into lp:desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 149
Merged at revision: not available
Proposed branch: lp:~cmiller/desktopcouch/retry-on-couchdb-death-bug530541
Merge into: lp:desktopcouch
Diff against target: 26 lines (+15/-1)
1 file modified
desktopcouch/start_local_couchdb.py (+15/-1)
To merge this branch: bzr merge lp:~cmiller/desktopcouch/retry-on-couchdb-death-bug530541
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Tim Cole (community) Approve
Review via email: mp+23280@code.launchpad.net

Commit message

Add a retry loop around the code that tries to get the PID and use the PID to find the port of desktopcouch. It will retry nine more times now, sleeping one second between each attempt.

To post a comment you must log in.
Revision history for this message
Tim Cole (tcole) :
review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

The code, it looks good.
The tests, they pass.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/start_local_couchdb.py'
2--- desktopcouch/start_local_couchdb.py 2010-03-18 19:42:55 +0000
3+++ desktopcouch/start_local_couchdb.py 2010-04-13 00:37:14 +0000
4@@ -244,7 +244,21 @@
5
6 def start_couchdb(ctx=local_files.DEFAULT_CONTEXT):
7 """Execute each step to start a desktop CouchDB."""
8- pid, port = run_couchdb(ctx=ctx)
9+ pid = None
10+ saved_exception = None
11+ for retry in range(10):
12+ try:
13+ pid, port = run_couchdb(ctx=ctx)
14+ break
15+ except RuntimeError, e:
16+ saved_exception = e
17+ logging.exception("Starting couchdb failed on try %d" % (retry,))
18+ time.sleep(1)
19+ continue
20+
21+ if pid is None:
22+ raise saved_exception
23+
24 # Note that we do not call update_design_documents here. This is because
25 # Couch won't actually have started yet, so when update_design_documents
26 # calls the Records API, that will call back into get_port and we end up

Subscribers

People subscribed via source and target branches