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

Unified Diff: chrome/common/extensions/docs/server2/redirector.py

Issue 63203002: Docserver: Make the hand-written Cron methods run first rather than last, since (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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
Index: chrome/common/extensions/docs/server2/redirector.py
diff --git a/chrome/common/extensions/docs/server2/redirector.py b/chrome/common/extensions/docs/server2/redirector.py
index c5e36353b6397996f5b8662480a409a913b401fc..acbc1608bf68f67a0b511fe2b0f082fe4ea025ba 100644
--- a/chrome/common/extensions/docs/server2/redirector.py
+++ b/chrome/common/extensions/docs/server2/redirector.py
@@ -6,6 +6,7 @@ import posixpath
from urlparse import urlsplit
from file_system import FileNotFoundError
+from future import Gettable, Future
class Redirector(object):
def __init__(self, compiled_fs_factory, file_system):
@@ -60,6 +61,9 @@ class Redirector(object):
def Cron(self):
''' Load files during a cron run.
'''
+ futures = []
for root, dirs, files in self._file_system.Walk(''):
if 'redirects.json' in files:
- self._cache.GetFromFile(posixpath.join(root, 'redirects.json')).Get()
+ futures.append(
+ self._cache.GetFromFile(posixpath.join(root, 'redirects.json')))
+ return Future(delegate=Gettable(lambda: [f.Get() for f in futures]))

Powered by Google App Engine
This is Rietveld 408576698