Skip to content

Commit e90a940

Browse files
committed
Do not break the cycle in case http req raise exception, just try later
1 parent 7083f32 commit e90a940

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

otsserver/backup.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,13 @@ def loop(self):
249249
try:
250250
r = requests.get(backup_url)
251251
except Exception as err:
252-
logging.error("Exception asking " + str(backup_url) + " message " + str(err))
253-
break
252+
logging.error("Exception asking %s error message %s, sleeping for %d seconds"
253+
% (str(backup_url), str(err), SLEEP_SECS))
254+
time.sleep(SLEEP_SECS)
255+
continue
254256

255257
if r.status_code != 200:
256-
logging.info("%s not found, sleeping for %s seconds" % (backup_url, SLEEP_SECS) )
258+
logging.info("%s not found, sleeping for %d seconds" % (backup_url, SLEEP_SECS))
257259
time.sleep(SLEEP_SECS)
258260
continue
259261

0 commit comments

Comments
 (0)