cutter: Don't set error on concurrent video update

If two cutters modify a video at the same time, youtube may respond with a 409 to one of them.
We want to treat that as a retryable error, and ideally let another cutter finish it instead.
pull/318/head
Mike Lang 2 years ago
parent 78ee38a4b9
commit 2fee3a6e9d

@ -768,7 +768,14 @@ class VideoUpdater(object):
else:
self.logger.exception("Failed to update video")
self.mark_errored(job.id, "Failed to update video: {}".format(ex))
# Explicitly retryable errors aren't problems
if isinstance(ex, UploadError) and ex.retryable:
self.logger.warning("Retryable error when updating video", exc_info=True)
# By giving up without marking as done or errored, another cutter should get it.
# Or we'll get it next loop.
else:
self.mark_errored(job.id, "Failed to update video: {}".format(ex))
continue
marked = self.mark_done(job, updates)

@ -254,6 +254,8 @@ class Youtube(UploadBackend):
},
metric_name='update_video',
)
if resp.status_code == 409:
raise UploadError("Multiple updates to same video, got 409: {}".format(resp.text), retryable=True)
resp.raise_for_status()
def set_thumbnail(self, video_id, thumbnail):

Loading…
Cancel
Save