Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1852)

Issue 9920043: Add option to automatically retry requests.

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by yovadia
Modified:
11 years, 2 months ago
Visibility:
Public.

Description

Add option to automatically retry requests.

Patch Set 1 #

Patch Set 2 : Fixed off-by-one, default value, and added comments. #

Total comments: 2

Patch Set 3 : Log warning messages, avoid sleeping after final retry #

Patch Set 4 : Added test to ensure that a final failed attempt doesn't needlessly sleep. #

Patch Set 5 : s/rand_fun/rand_stub/ and s/sleep_fun/sleep_stub/ #

Total comments: 8

Patch Set 6 : Address jcgregorio comments; support retry for media requests. #

Total comments: 6

Patch Set 7 : Fixes to comments and test style. #

Patch Set 8 : Minor test changes. #

Patch Set 9 : One more style fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+263 lines, -34 lines) Patch
M apiclient/http.py View 1 2 3 4 5 6 10 chunks +109 lines, -34 lines 0 comments Download
M tests/test_http.py View 1 2 3 4 5 6 7 8 6 chunks +154 lines, -0 lines 0 comments Download

Messages

Total messages: 10
yovadia
11 years, 3 months ago (2013-05-31 22:14:05 UTC) #1
jterrace
LGTM https://codereview.appspot.com/9920043/diff/2001/apiclient/http.py File apiclient/http.py (right): https://codereview.appspot.com/9920043/diff/2001/apiclient/http.py#newcode692 apiclient/http.py:692: self._sleep_fun(0.5 + self._rand_fun() * 2**retry_num) How about a ...
11 years, 3 months ago (2013-06-03 16:14:31 UTC) #2
yovadia
Thanks. I added a warning log message and fixed the retry logic not to sleep ...
11 years, 3 months ago (2013-06-03 21:36:32 UTC) #3
yovadia
Ping? Also, I've added a new test and made some minor naming changes.
11 years, 3 months ago (2013-06-05 14:22:22 UTC) #4
jcgregorio_google
https://codereview.appspot.com/9920043/diff/14001/apiclient/http.py File apiclient/http.py (right): https://codereview.appspot.com/9920043/diff/14001/apiclient/http.py#newcode601 apiclient/http.py:601: rand_stub=random.random, See below, these should be dropped. https://codereview.appspot.com/9920043/diff/14001/apiclient/http.py#newcode643 apiclient/http.py:643: ...
11 years, 3 months ago (2013-06-07 13:57:11 UTC) #5
yovadia
Thanks; PTAL. https://codereview.appspot.com/9920043/diff/14001/apiclient/http.py File apiclient/http.py (right): https://codereview.appspot.com/9920043/diff/14001/apiclient/http.py#newcode601 apiclient/http.py:601: rand_stub=random.random, On 2013/06/07 13:57:12, jcgregorio_google wrote: > ...
11 years, 3 months ago (2013-06-10 22:34:21 UTC) #6
jcgregorio_google
https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py File apiclient/http.py (right): https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py#newcode672 apiclient/http.py:672: binary exponential backoff. If all retries fail, the raised ...
11 years, 2 months ago (2013-06-13 19:26:25 UTC) #7
yovadia
Thanks; PTAL. https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py File apiclient/http.py (right): https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py#newcode672 apiclient/http.py:672: binary exponential backoff. If all retries fail, ...
11 years, 2 months ago (2013-06-13 20:15:22 UTC) #8
jcgregorio_google
On 2013/06/13 20:15:22, yovadia wrote: > Thanks; PTAL. > > https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py > File apiclient/http.py (right): ...
11 years, 2 months ago (2013-06-14 20:27:17 UTC) #9
jcgregorio_google
11 years, 2 months ago (2013-06-14 20:33:15 UTC) #10
On 2013/06/14 20:27:17, jcgregorio_google wrote:
> On 2013/06/13 20:15:22, yovadia wrote:
> > Thanks; PTAL.
> > 
> > https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py
> > File apiclient/http.py (right):
> > 
> >
https://codereview.appspot.com/9920043/diff/25001/apiclient/http.py#newcode672
> > apiclient/http.py:672: binary exponential backoff. If all retries fail, the
> > raised
> > On 2013/06/13 19:26:25, jcgregorio_google wrote:
> > > Do we need to specify 'binary', or is just 'exponential' detailed enough?
> > 
> > Done.
> > 
> > https://codereview.appspot.com/9920043/diff/25001/tests/test_http.py
> > File tests/test_http.py (right):
> > 
> >
>
https://codereview.appspot.com/9920043/diff/25001/tests/test_http.py#newcode328
> > tests/test_http.py:328: for retry_num in xrange(num_retries):
> > On 2013/06/13 19:26:25, jcgregorio_google wrote:
> > > oh, that's tricky, can you add a comment on what you're doing here. Or
> switch
> > it
> > > to an explicit list of expected_sleeptimes =[1, 2, ...]
> > 
> > Done.
> > 
> >
>
https://codereview.appspot.com/9920043/diff/25001/tests/test_http.py#newcode659
> > tests/test_http.py:659: request.execute()
> > On 2013/06/13 19:26:25, jcgregorio_google wrote:
> > > add:
> > > 
> > >    self.fail("Should have raised exception.")
> > 
> > Done.
> 
> LGTM, thanks!

Committed at
https://code.google.com/p/google-api-python-client/source/detail?r=b88d4a00ee...
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b