From 55fd55714a374eaedfab457f7e7254f816911ff1 Mon Sep 17 00:00:00 2001
From: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Date: Wed, 16 May 2018 19:29:45 +0900
Subject: Raise Mastodon::RaceConditionError if Redis lock failed (#7511)

An explicit error allows user agents to know the error and Sidekiq to
retry.
---
 app/controllers/media_proxy_controller.rb | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'app/controllers')

diff --git a/app/controllers/media_proxy_controller.rb b/app/controllers/media_proxy_controller.rb
index 155670837..d820b257e 100644
--- a/app/controllers/media_proxy_controller.rb
+++ b/app/controllers/media_proxy_controller.rb
@@ -8,6 +8,8 @@ class MediaProxyController < ApplicationController
       if lock.acquired?
         @media_attachment = MediaAttachment.remote.find(params[:id])
         redownload! if @media_attachment.needs_redownload? && !reject_media?
+      else
+        raise Mastodon::RaceConditionError
       end
     end
 
-- 
cgit