0

这是我拥有的代码

class ExampleTask
    extend Resque::Plugins::ExponentialBackoff
    @backoff_strategy = [0, 20, 3600]
    @queue = :example_tasks
    def self.perform
      raise
    end
  end

我遇到了一个问题,每当我在本地将此任务排入队列时,Resque 似乎会立即重试该任务,而不考虑退避策略。有没有人遇到过这个问题?

4

2 回答 2

0

升级到 1.0.0 实际上解决了这个问题。

于 2012-10-03T04:43:16.390 回答
0

对于任何未来的读者,数组中的第一个整数@backoff_strategy是 Resque-Retry 在第一次重试之前将等待多长时间。来自github 自述文件

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.
于 2014-11-12T18:08:31.530 回答