From cc32f0f50bcd25117fae3ca32ea174558b03d97c Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 17 Sep 2019 22:24:50 -0500 Subject: make `BatchFetchMediaWorker` emergency stoppable by setting `Rails.cache.write(stop_fetch_media_worker, true)` --- app/workers/batch_fetch_media_worker.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/workers') 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 -- cgit