about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/workers/batch_fetch_media_worker.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/workers/batch_fetch_media_worker.rb b/app/workers/batch_fetch_media_worker.rb
index c002aeee7..25f8d58bb 100644
--- a/app/workers/batch_fetch_media_worker.rb
+++ b/app/workers/batch_fetch_media_worker.rb
@@ -7,6 +7,10 @@ class BatchFetchMediaWorker
 
   def perform(media_attachment_ids)
     media_attachment_ids.each_with_index do |attachment_id, index|
+      if Rails.cache.fetch('stop_fetch_media_worker', false)
+        Rails.cache.delete('stop_fetch_media_worker')
+        break
+      end
       FetchMediaWorker.perform_async(attachment_id)
       sleep(0.5 * Sidekiq::Queue.new(:bulk).size)
     end