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

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

Issue 575613003: Docserver: Gitiles auth and cron refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
Index: chrome/common/extensions/docs/server2/content_providers.py
diff --git a/chrome/common/extensions/docs/server2/content_providers.py b/chrome/common/extensions/docs/server2/content_providers.py
index 4940d6222ccd74f9c989523621f9d10a3f85b2d6..e520017f4ae08b4587b41580d9a4425720f76c4f 100644
--- a/chrome/common/extensions/docs/server2/content_providers.py
+++ b/chrome/common/extensions/docs/server2/content_providers.py
@@ -55,7 +55,7 @@ class ContentProviders(object):
# If running the devserver and there is a LOCAL_DEBUG_DIR, we
# will read the content_provider configuration from there instead
- # of fetching it from SVN trunk or patch.
+ # of fetching it from Gitiles or patch.
if environment.IsDevServer() and os.path.exists(LOCAL_DEBUG_DIR):
local_fs = LocalFileSystem(LOCAL_DEBUG_DIR)
conf_stat = None
@@ -170,23 +170,28 @@ class ContentProviders(object):
supports_templates=supports_templates,
supports_zip=supports_zip)
- def Cron(self):
+ def GetRefreshPaths(self):
+ return self._GetConfig().keys()
+
+ def Refresh(self, path):
def safe(name, action, callback):
'''Safely runs |callback| for a ContentProvider called |name| by
swallowing exceptions and turning them into a None return value. It's
- important to run all ContentProvider Crons even if some of them fail.
+ important to run all ContentProvider Refreshes even if some of them fail.
'''
try:
return callback()
except:
if not _IGNORE_MISSING_CONTENT_PROVIDERS[0]:
- logging.error('Error %s Cron for ContentProvider "%s":\n%s' %
+ logging.error('Error %s Refresh for ContentProvider "%s":\n%s' %
(action, name, traceback.format_exc()))
return None
- futures = [(name, safe(name,
- 'initializing',
- self._CreateContentProvider(name, config).Cron))
- for name, config in self._GetConfig().iteritems()]
- return Future(callback=
- lambda: [safe(name, 'resolving', f.Get) for name, f in futures if f])
+ config = self._GetConfig()[path]
+ provider = self._CreateContentProvider(path, config)
+ future = safe(path,
+ 'initializing',
+ self._CreateContentProvider(path, config).Refresh)
+ if future is None:
+ return Future(callback=lambda: True)
+ return Future(callback=lambda: safe(path, 'resolving', future.Get))
« no previous file with comments | « chrome/common/extensions/docs/server2/content_provider_test.py ('k') | chrome/common/extensions/docs/server2/cron.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698