diff options
Diffstat (limited to 'app/workers/unpublish_announcement_worker.rb')
-rw-r--r-- | app/workers/unpublish_announcement_worker.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/workers/unpublish_announcement_worker.rb b/app/workers/unpublish_announcement_worker.rb new file mode 100644 index 000000000..e99d70cf8 --- /dev/null +++ b/app/workers/unpublish_announcement_worker.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class UnpublishAnnouncementWorker + include Sidekiq::Worker + include Redisable + + def perform(announcement_id) + payload = Oj.dump(event: :'announcement.delete', payload: announcement_id.to_s) + + FeedManager.instance.with_active_accounts do |account| + redis.publish("timeline:#{account.id}", payload) if redis.exists("subscribed:timeline:#{account.id}") + end + end +end |