distribution_worker.rb 362 B

123456789101112131415
  1. # frozen_string_literal: true
  2. class DistributionWorker
  3. include Sidekiq::Worker
  4. include Redisable
  5. include Lockable
  6. def perform(status_id, options = {})
  7. with_redis_lock("distribute:#{status_id}") do
  8. FanOutOnWriteService.new.call(Status.find(status_id), **options.symbolize_keys)
  9. end
  10. rescue ActiveRecord::RecordNotFound
  11. true
  12. end
  13. end