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

Unified Diff: gae/file_reader.py

Issue 1150463002: [chrome-devtools-frontend] Migrate to cloudstorage client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chrome-devtools-frontend
Patch Set: Created 5 years, 7 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 | « gae/content_type.py ('k') | gae/pre_cacher.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gae/file_reader.py
diff --git a/gae/file_reader.py b/gae/file_reader.py
index a0c92903503f768705160ae001cdde903f85ef2d..e701cb557472d5a97109e57923eefeee178aec4a 100644
--- a/gae/file_reader.py
+++ b/gae/file_reader.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from google.appengine.api import files
+import cloudstorage
import logging
import traceback
@@ -14,13 +14,12 @@ def read(config_helper, file_name):
return content
# Sometimes remote calls fail for different reasons. Make sure we retry.
full_path = config_helper.get_full_path(file_name)
- for _ in [1, 2, 3]:
- try:
- with files.open(full_path, 'r') as stream:
- content = stream.read()
- cache.set_content(file_name, content)
- return content
- except:
- logging.error('Full path: %s' % full_path)
- logging.error(traceback.format_exc())
+ try:
+ with cloudstorage.open(full_path, 'r') as stream:
+ content = stream.read()
+ cache.set_content(file_name, content)
+ return content
+ except:
+ logging.error('Full path: %s' % full_path)
+ logging.error(traceback.format_exc())
return None
« no previous file with comments | « gae/content_type.py ('k') | gae/pre_cacher.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698