# frozen_string_literal: true

class ActivityPub::SynchronizeFeaturedCollectionWorker
  include Sidekiq::Worker

  sidekiq_options queue: 'pull'

  def perform(account_id)
    ActivityPub::FetchFeaturedCollectionService.new.call(Account.find(account_id))
  rescue ActiveRecord::RecordNotFound
    true
  end
end

# frozen_string_literal: true

class ActivityPub::SynchronizeFeaturedCollectionWorker
  include Sidekiq::Worker

  sidekiq_options queue: 'pull', unique: :until_executed

  def perform(account_id)
    ActivityPub::FetchFeaturedCollectionService.new.call(Account.find(account_id))
  rescue ActiveRecord::RecordNotFound
    true
  end
end

Make Execution of SynchronizeFeaturedCollectionWorker unique
Make Execution of SynchronizeFeaturedCollectionWorker unique

See: https://github.com/tootsuite/mastodon/pull/7043/commits/b759b0564fc17ddf1bca06142c32d8b55578f9b4
