mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-09-10 12:18:10 +00:00
20 lines
452 B
Ruby
20 lines
452 B
Ruby
|
# 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|
|
||
|
PublishScheduledStatusWorker.perform_at(scheduled_status.scheduled_at)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def due_statuses
|
||
|
ScheduledStatus.where('scheduled_at <= ?', Time.now.utc + PostStatusService::MIN_SCHEDULE_OFFSET)
|
||
|
end
|
||
|
end
|