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

Unified Diff: chrome/common/extensions/docs/server2/api_data_source.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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_list_data_source.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/api_data_source.py
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
index 1608da8c5770e82c7cb6c28b7c8344582e3c26b0..d3806e58cb6a5110fcc626707e6ea89010b6dfd5 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import logging
+
from data_source import DataSource
from docs_server_utils import StringIdentity
from environment import IsPreviewServer
@@ -89,9 +91,16 @@ class APIDataSource(DataSource):
getter.get = lambda api_name: self._GetImpl(platform, api_name).Get()
return getter
- def Cron(self):
- futures = []
+ def GetRefreshPaths(self):
+ tasks = []
for platform in GetPlatforms():
- futures += [self._GetImpl(platform, name)
- for name in self._platform_bundle.GetAPIModels(platform).GetNames()]
- return All(futures, except_pass=FileNotFoundError)
+ tasks += ['%s/%s' % (platform, api)
+ for api in
+ self._platform_bundle.GetAPIModels(platform).GetNames()]
+ return tasks
+
+ def Refresh(self, path):
+ platform, api = path.split('/')
+ logging.info('Refreshing %s/%s' % (platform, api))
+ future = self._GetImpl(platform, api)
+ return All([future], except_pass=FileNotFoundError)
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_list_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698