Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: globals/get_browser_versions.py

Issue 29321081: Issue 2722 - Don't report persistent errors with external APIs more often than once a day (Closed)
Patch Set: Created June 25, 2015, 12:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
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: globals/get_browser_versions.py
===================================================================
--- a/globals/get_browser_versions.py
+++ b/globals/get_browser_versions.py
@@ -197,7 +197,8 @@
raise exc_info[0], exc_info[1], exc_info[2]
versions = cached_versions
- if now - versions['timestamp'] > 60*60*2:
+ if now > versions['fail_silently_until']:
+ versions['fail_silently_until'] = now + 60*60*24
logging.warning('Failed to get %s versions, falling back to '
'cached versions', browser, exc_info=exc_info)
else:
@@ -222,11 +223,12 @@
key=key_by_version
)
- versions['timestamp'] = now
+ versions['fail_silently_until'] = now + 60*60*2
persistent_cache[browser] = versions
- file.seek(0)
- json.dump(persistent_cache, file)
- file.truncate()
+
+ file.seek(0)
+ json.dump(persistent_cache, file)
+ file.truncate()
if not versions['previous']:
logging.warning("Couldn't determine previous browser version, "
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld