2012-09-25 78 views
0

重試。這是我有Resque重試無延遲

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

我遇到了在那裏,每當我在本地排隊這個任務,Resque似乎立即重試任務,而不尊重退避策略有問題的代碼。有沒有人曾經遇到過這個問題?

回答

0

升級到1.0.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.