This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2019-01-05 03:43:28 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Scheduler::ScheduledStatusesScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
sidekiq_options unique: :until_executed, retry: 0
|
|
|
|
|
|
|
|
def perform
|
|
|
|
due_statuses.find_each do |scheduled_status|
|
2019-01-06 00:21:16 -08:00
|
|
|
PublishScheduledStatusWorker.perform_at(scheduled_status.scheduled_at, scheduled_status.id)
|
2019-01-05 03:43:28 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def due_statuses
|
|
|
|
ScheduledStatus.where('scheduled_at <= ?', Time.now.utc + PostStatusService::MIN_SCHEDULE_OFFSET)
|
|
|
|
end
|
|
|
|
end
|