diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-09-17 21:25:29 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-09-17 21:25:29 -0500 |
commit | 3bb237800983fe6c58520fd272530e2a6bef0709 (patch) | |
tree | 4e8480c68c2dcc2fab3d33aa6a0e6e34acae19de /app/workers | |
parent | e2f7f1db860c45112ce9c94859bc19cd53cab773 (diff) |
add `FetchAvatarWorker` to (re-)fetch account avatars/headers
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/fetch_avatar_worker.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/workers/fetch_avatar_worker.rb b/app/workers/fetch_avatar_worker.rb new file mode 100644 index 000000000..01a7078dc --- /dev/null +++ b/app/workers/fetch_avatar_worker.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class FetchAvatarMediaWorker + include Sidekiq::Worker + + sidekiq_options queue: 'bulk', retry: 2 + + def perform(account_id) + account = Account.find(account_id) + return if account.suspended_at? + account.reset_avatar! unless account.avatar_remote_url.nil? + account.reset_header! unless account.header_remote_url.nil? + rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid + true + end +end |