From 00b5731ecb2c29dd5c79a233f046a9655031ec71 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 11 Feb 2017 14:12:29 +0100 Subject: After FollowService, re-fetch remote account asynchronously, do nothing if account lock info was up to date, otherwise re-do the FollowService with now updated information --- app/workers/after_remote_follow_worker.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/workers/after_remote_follow_worker.rb (limited to 'app/workers/after_remote_follow_worker.rb') diff --git a/app/workers/after_remote_follow_worker.rb b/app/workers/after_remote_follow_worker.rb new file mode 100644 index 000000000..496aaf73e --- /dev/null +++ b/app/workers/after_remote_follow_worker.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AfterRemoteFollowWorker + include Sidekiq::Worker + + sidekiq_options retry: 5 + + def perform(follow_id) + follow = Follow.find(follow_id) + updated_account = FetchRemoteAccountService.new.call(follow.target_account.remote_url) + + return unless updated_account.locked? + + follow.destroy + FollowService.new.call(follow.account, updated_account.acct) + end +end -- cgit