diff options
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 |