Resque重试无延迟
问题描述:
重试。这是我有Resque重试无延迟
class ExampleTask
extend Resque::Plugins::ExponentialBackoff
@backoff_strategy = [0, 20, 3600]
@queue = :example_tasks
def self.perform
raise
end
end
我遇到了在那里,每当我在本地排队这个任务,Resque似乎立即重试任务,而不尊重退避策略有问题的代码。有没有人曾经遇到过这个问题?
答
升级到1.0.0实际上解决了这个问题。
答
对于任何未来的读者,数组@backoff_strategy
中的第一个整数是Resque-Retry在第一次重试之前等待的时间。来自github readme:
key: m = minutes, h = hours
no delay, 1m, 10m, 1h, 3h, 6h
@backoff_strategy = [0, 60, 600, 3600, 10800, 21600]
@retry_delay_multiplicand_min = 1.0
@retry_delay_multiplicand_max = 1.0
The first delay will be 0 seconds, the 2nd will be 60 seconds, etc... Again, tweak to your own needs.