diff options
-rwxr-xr-x | issues.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -48,6 +48,7 @@ def __rest_call_unchecked(before, after, data_dict=None): return response def rest_call(before, after, data_dict=None): + count500err = 0 while True: try: return __rest_call_unchecked(before, after, data_dict) @@ -60,6 +61,13 @@ def rest_call(before, after, data_dict=None): l /= 2 data_dict = dict(map(lambda (k,v): (k,v[0:l]), data_dict.iteritems())) continue + elif e.code == 500: + N = 5 + if count500err >= N: raise e + print "Waiting 10 seconds, will try", (N - count500err), "more times" + sleep(10) + count500err += 1 + continue raise e # reraise, we cannot handle it def labelify(string): |