@@ -88,7 +88,10 @@ def _heartbeat(qclient, url):
88
88
# This error occurs when the Qiita server is not reachable. This
89
89
# may occur when we are updating the server, and we don't want
90
90
# the job to fail. In this case, we wait for 5 min and try again
91
- time .sleep (randint (MIN_TIME_SLEEP , MAX_TIME_SLEEP ))
91
+ stime = randint (MIN_TIME_SLEEP , MAX_TIME_SLEEP )
92
+ logger .debug ('retry _heartbeat() %d, %d, %s' % (
93
+ retries , stime , url ))
94
+ time .sleep (stime )
92
95
retries -= 1
93
96
except QiitaClientError :
94
97
# If we raised the error, we propagate it since it is a problem
@@ -261,7 +264,11 @@ def _request_oauth2(self, req, *args, **kwargs):
261
264
except requests .ConnectionError :
262
265
if retries <= 0 :
263
266
raise
264
- time .sleep (randint (MIN_TIME_SLEEP , MAX_TIME_SLEEP ))
267
+ stime = randint (MIN_TIME_SLEEP , MAX_TIME_SLEEP )
268
+ logger .debug (
269
+ 'retry QiitaClient._request_oauth2() %d, %d' % (
270
+ retries , stime ))
271
+ time .sleep (stime )
265
272
retries -= 1
266
273
if r .status_code == 400 :
267
274
try :
@@ -347,7 +354,10 @@ def _request_retry(self, req, url, **kwargs):
347
354
return r .json ()
348
355
except ValueError :
349
356
return None
350
- time .sleep (randint (MIN_TIME_SLEEP , MAX_TIME_SLEEP ))
357
+ stime = randint (MIN_TIME_SLEEP , MAX_TIME_SLEEP )
358
+ logger .debug ('retry QiitaClient._request_retry() %d, %d, %s' % (
359
+ retries , stime , url ))
360
+ time .sleep (stime )
351
361
352
362
raise RuntimeError (
353
363
"Request '%s %s' did not succeed. Status code: %d. Message: %s"
0 commit comments