Sidekiq perform_in 即使在队列不断满的情况下也能正常工作吗?
Will Sidekiq perform_in work even with a constantly full queue?
例如,如果我想在一个小时内执行一个作业并执行'MyWorker.perform_in 1.hour',但是队列中的人太多以至于一个小时后队列仍然已满,那么该作业会不会我想在一个小时内在所需时间执行,还是会在队列末尾排队?
The Poller checks Redis every N seconds for jobs in the retry or scheduled set have passed their timestamp and should be enqueued. If so, it just pops the job back onto its original queue so the workers can pick it up like any other job.
还有一个 bit farther down:
def start
@thread ||= safe_thread("scheduler") do
initial_wait
while !@done
enqueue
wait
end
Sidekiq.logger.info("Scheduler exiting...")
end
end
看来调度程序会在预定时间排队作业,而不是强制工作人员在那个时间开始执行作业。
一种可能的解决方案是为计划作业设置一个自定义队列,为非计划作业设置一个自定义队列。这样如果预定的作业队列已满,另一个队列仍然可以处理作业。 Sidekiq wiki 中提供了有关队列的更多信息,其中更详细地描述了此类设置。
例如,如果我想在一个小时内执行一个作业并执行'MyWorker.perform_in 1.hour',但是队列中的人太多以至于一个小时后队列仍然已满,那么该作业会不会我想在一个小时内在所需时间执行,还是会在队列末尾排队?
The Poller checks Redis every N seconds for jobs in the retry or scheduled set have passed their timestamp and should be enqueued. If so, it just pops the job back onto its original queue so the workers can pick it up like any other job.
还有一个 bit farther down:
def start
@thread ||= safe_thread("scheduler") do
initial_wait
while !@done
enqueue
wait
end
Sidekiq.logger.info("Scheduler exiting...")
end
end
看来调度程序会在预定时间排队作业,而不是强制工作人员在那个时间开始执行作业。
一种可能的解决方案是为计划作业设置一个自定义队列,为非计划作业设置一个自定义队列。这样如果预定的作业队列已满,另一个队列仍然可以处理作业。 Sidekiq wiki 中提供了有关队列的更多信息,其中更详细地描述了此类设置。