Index: dashboard/dashboard/graph_revisions.py |
diff --git a/dashboard/dashboard/graph_revisions.py b/dashboard/dashboard/graph_revisions.py |
index 0aee43ef0dffac05b765d3590a26b2b616f4b8ca..0f8b13c71b9fdf6fcac6056ff553d390d5b39da8 100644 |
--- a/dashboard/dashboard/graph_revisions.py |
+++ b/dashboard/dashboard/graph_revisions.py |
@@ -78,10 +78,11 @@ def _UpdateCache(test_key): |
Returns: |
The list of triplets that was just fetched and set in the cache. |
""" |
- if not test_key.get(): |
- # The caching can actually proceed even if the Test entity doesn't exist, |
- # but a non-existent Test entity definitely indicates something is wrong. |
- logging.warn('Test not found: %s', utils.TestPath(test_key)) |
+ test = test_key.get() |
+ if not test: |
+ return |
qyearsley
2015/12/28 22:50:56
Should we return [] here? Or explicitly return Non
sullivan
2015/12/29 03:36:07
I changed it to []
|
+ assert(utils.IsInternalUser() or not test.internal_only) |
+ datastore_hooks.SetSinglePrivilegedRequest() |
# A projection query queries just for the values of particular properties; |
# this is faster than querying for whole entities. |
@@ -90,6 +91,9 @@ def _UpdateCache(test_key): |
# Using a large batch_size speeds up queries with > 1000 Rows. |
rows = map(_MakeTriplet, query.iter(batch_size=1000)) |
+ # Note: Unit tests do not call datastore_hooks with the above query, but |
+ # it is called in production and with more recent SDK. |
+ datastore_hooks.CancelSinglePrivilegedRequest() |
SetCache(utils.TestPath(test_key), rows) |
return rows |