Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2071)

Unified Diff: appengine/swarming/swarming_bot/bot_code/bot_main.py

Issue 2181343002: swarming: Back off requests on poll failure. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Math is hard Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/swarming_bot/bot_code/bot_main.py
diff --git a/appengine/swarming/swarming_bot/bot_code/bot_main.py b/appengine/swarming/swarming_bot/bot_code/bot_main.py
index b50d7ebbd95b2e19b6e0bbb20978d656c5b360c6..2043f6c7a646a7c9e040dc0ec725c421042b6f9d 100644
--- a/appengine/swarming/swarming_bot/bot_code/bot_main.py
+++ b/appengine/swarming/swarming_bot/bot_code/bot_main.py
@@ -518,6 +518,8 @@ def poll_server(botobj, quit_bit):
resp = botobj.remote.url_read_json(
'/swarming/api/v1/bot/poll', data=botobj._attributes)
if not resp:
+ # Back off on failure.
+ time.sleep(max(1, min(60, botobj.state.get('sleep_streak', 10) * 2)))
return False
logging.debug('Server response:\n%s', resp)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698