diff options
author | chipx86 <chipx86@5efc13c4-1f27-0410-8691-ff2d1f55687e> | 2009-05-28 10:03:50 +0000 |
---|---|---|
committer | chipx86 <chipx86@5efc13c4-1f27-0410-8691-ff2d1f55687e> | 2009-05-28 10:03:50 +0000 |
commit | dd6930b2699168b2b2b28b0885e7319d92f2ddd7 (patch) | |
tree | 5525d6201b2bcd62f6ac6098b92fca377f8bf5fc | |
parent | 772b4db4bda1e15d953727e83bc76e4e256127ae (diff) |
Patch by Chris Clark to set a max number of login retries, so as to
prevent entering an infinite loop. This can happen when the cookie is
assumed to be valid but doesn't work properly on the server. While this
won't fix logins in that situation, it will prevent the infinite loop
followed by a "maximum recursion deptch" error.
Reviewed at http://reviews.review-board.org/r/879/
-rwxr-xr-x | scripts/post-review | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts/post-review b/scripts/post-review index 05eba08..e0590a8 100755 --- a/scripts/post-review +++ b/scripts/post-review @@ -2132,7 +2132,7 @@ def load_config_file(filename): def tempt_fate(server, tool, changenum, diff_content=None, - parent_diff_content=None, submit_as=None): + parent_diff_content=None, submit_as=None, retries=3): """ Attempts to create a review request on a Review Board server and upload a diff. On success, the review request path is displayed. @@ -2185,10 +2185,18 @@ def tempt_fate(server, tool, changenum, diff_content=None, except APIError, e: rsp, = e.args if rsp['err']['code'] == 103: # Not logged in - server.login(force=True) - tempt_fate(server, tool, changenum, diff_content, - parent_diff_content, submit_as) - return + retries = retries - 1 + + # We had an odd issue where the server ended up a couple of + # years in the future. Login succeeds but the cookie date was + # "odd" so use of the cookie appeared to fail and eventually + # ended up at max recursion depth :-(. Check for a maximum + # number of retries. + if retries >= 0: + server.login() + tempt_fate(server, tool, changenum, diff_content, + parent_diff_content, submit_as, retries=retries) + return if options.rid: die("Error getting review request %s: %s (code %s)" % \ |