Skip to content

Commit 617c1d4

Browse files
committed
Be more defensive with our storage uploading
Currently we're seeing ~15 of these fail each hour, because of an issue we're having with Azure. Let's not fail builds on this situation.
1 parent 439e8af commit 617c1d4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

readthedocs/builds/syncers.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,16 @@ def copy(cls, path, target, host, is_file=False, **kwargs): # pylint: disable=a
213213
any([target.lower().endswith(ext) for ext in cls.extensions]):
214214
log.info('Selective Copy %s to media storage', target)
215215

216-
storage_path = cls.get_storage_path(target)
216+
try:
217+
storage_path = cls.get_storage_path(target)
217218

218-
if storage.exists(storage_path):
219-
storage.delete(storage_path)
219+
if storage.exists(storage_path):
220+
storage.delete(storage_path)
220221

221-
with open(target, 'rb') as fd:
222-
storage.save(storage_path, fd)
222+
with open(target, 'rb') as fd:
223+
storage.save(storage_path, fd)
224+
except Exception:
225+
log.exception('Storage access failed for file. Not failing build.')
223226

224227

225228
class Syncer(SettingsOverrideObject):

0 commit comments

Comments
 (0)