public
Description: Database based asynchronously priority queue system -- Extracted from Shopify
Homepage: http://www.shopify.com
Clone URL: git://github.com/tobi/delayed_job.git
Search Repo:
Increase job rescheduling timeouts
Tobias Luetke (home) (author)
Sun Feb 17 18:21:48 -0800 2008
commit  2309a943d87db9707a7d93999cfe6c264197b8bf
tree    729137e66b274891b22ac04bc9bb932db36e3049
parent  75b49dc1c281ffa934a4eb2c7e840291e8b4a5ff
...
67
68
69
70
 
71
72
73
...
67
68
69
 
70
71
72
73
0
@@ -67,7 +67,7 @@
0
   
0
     def reshedule(message)
0
       self.attempts += 1
0
- self.run_at = self.class.time_now + 5.minutes
0
+ self.run_at = self.class.time_now + (attempts ** 4).seconds
0
       self.last_error = message
0
       save!
0
     end
...
53
54
55
56
 
57
58
59
...
62
63
64
65
 
66
67
68
...
53
54
55
 
56
57
58
59
...
62
63
64
 
65
66
67
68
0
@@ -53,7 +53,7 @@
0
     SimpleJob.runs.should == 1
0
   end
0
   
0
- it "should re-schedule by about 5 minutes when it fails to execute properly" do
0
+ it "should re-schedule by about 1 second at first and increment this more and more minutes when it fails to execute properly" do
0
     Delayed::Job.enqueue ErrorJob.new
0
     runner = Delayed::Job.work_off(1)
0
     runner.success.should == 0
0
@@ -62,7 +62,7 @@
0
     job = Delayed::Job.find(:first)
0
     job.last_error.should == 'did not work'
0
     job.attempts.should == 1
0
- job.run_at.should > Time.now + 4.minutes
0
+ job.run_at.should > Time.now
0
     job.run_at.should < Time.now + 6.minutes
0
   end
0
   

Comments

    No one has commented yet.