2023-08-24 14:40:04 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AddToPublicStatusesIndexWorker
|
|
|
|
include Sidekiq::Worker
|
2023-08-27 20:38:01 +00:00
|
|
|
include DatabaseHelper
|
2023-08-24 14:40:04 +00:00
|
|
|
|
2023-08-27 16:58:20 +00:00
|
|
|
sidekiq_options queue: 'pull'
|
|
|
|
|
2023-08-24 14:40:04 +00:00
|
|
|
def perform(account_id)
|
2023-08-27 20:38:01 +00:00
|
|
|
with_primary do
|
|
|
|
@account = Account.find(account_id)
|
|
|
|
end
|
2023-08-24 14:40:04 +00:00
|
|
|
|
2023-08-27 20:38:01 +00:00
|
|
|
return unless @account.indexable?
|
2023-08-24 14:40:04 +00:00
|
|
|
|
2023-08-27 20:38:01 +00:00
|
|
|
with_read_replica do
|
|
|
|
@account.add_to_public_statuses_index!
|
|
|
|
end
|
2023-08-24 14:40:04 +00:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|