diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-09-17 21:32:47 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-09-17 21:32:47 -0500 |
commit | 71bb4f01bc104ef32b14fd82a6ecc4b35d56fee2 (patch) | |
tree | 01e2be98deb000b6b7241cb8a5c51a61d737422a /app | |
parent | 3bb237800983fe6c58520fd272530e2a6bef0709 (diff) |
`FetchMediaWorker` no longer re-fetches stuff the server already has unless `force` is set
Diffstat (limited to 'app')
-rw-r--r-- | app/workers/fetch_media_worker.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/workers/fetch_media_worker.rb b/app/workers/fetch_media_worker.rb index 02407db16..3e5eafb66 100644 --- a/app/workers/fetch_media_worker.rb +++ b/app/workers/fetch_media_worker.rb @@ -5,9 +5,10 @@ class FetchMediaWorker sidekiq_options queue: 'bulk', retry: 2 - def perform(media_attachment_id, remote_url = nil) + def perform(media_attachment_id, remote_url: nil, force: false) object = MediaAttachment.find(media_attachment_id.to_i) return if object.blocked? + return unless force || object.needs_redownload? if remote_url.nil? return if object.remote_url.nil? else |