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

Unified Diff: chrome/common/extensions/docs/server2/samples_model.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/samples_model.py
diff --git a/chrome/common/extensions/docs/server2/samples_model.py b/chrome/common/extensions/docs/server2/samples_model.py
index fa66dc39bbaefcbcfdfca5caaa8861218e2d037a..276022754e3cebfb833fbba3373ac5159e1aeaf0 100644
--- a/chrome/common/extensions/docs/server2/samples_model.py
+++ b/chrome/common/extensions/docs/server2/samples_model.py
@@ -60,8 +60,17 @@ class SamplesModel(object):
'''Fetches and filters the list of samples for this platform, returning
only the samples that use the API |api_name|.
'''
- samples_list = self._samples_cache.GetFromFileListing(
- '' if self._platform == 'apps' else EXAMPLES).Get()
+ try:
+ # TODO(rockot): This cache is probably not working as intended, since
+ # it can still lead to underlying filesystem (e.g. gitiles) access
+ # while processing live requests. Because this can fail, we at least
+ # trap and log exceptions to prevent 500s from being thrown.
+ samples_list = self._samples_cache.GetFromFileListing(
+ '' if self._platform == 'apps' else EXAMPLES).Get()
+ except Exception as e:
+ logging.warning('Unable to get samples listing. Skipping.')
+ samples_list = []
+
return [sample for sample in samples_list if any(
call['name'].startswith(api_name + '.')
for call in sample['api_calls'])]
« no previous file with comments | « chrome/common/extensions/docs/server2/samples_data_source.py ('k') | chrome/common/extensions/docs/server2/servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698