public this repo is viewable by everyone
Description: Database based asynchronously priority queue system -- Extracted from Shopify
Homepage: http://www.shopify.com
Clone URL: git://github.com/tobi/delayed_job.git
Don't save jobs with empty handlers
Tobias Lütke (author)
about 1 month ago
commit  b9dc92b9ca14e7cf2ec892c3ca3a1cb006989838
tree    6973231e0d44f9848631cd753b25463e6923c8b5
parent  0880b0f0924b41562b19b4b03a89b85bf660f02d
...
1
 
 
 
 
 
 
 
2
3
4
...
10
11
12
13
 
 
 
 
 
 
 
 
 
 
14
15
16
...
20
21
22
 
 
 
 
 
 
 
23
 
24
25
26
...
48
49
50
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
53
54
...
1
2
3
4
5
6
7
8
9
10
11
...
17
18
19
 
20
21
22
23
24
25
26
27
28
29
30
31
32
...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...
72
73
74
 
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
0
@@ -1,4 +1,11 @@
0
 require File.dirname(__FILE__) + '/database'
0
+
0
+if not defined?(:ActiveRecord)
0
+ module ActiveRecord
0
+ class RecordNotFound < StandardError
0
+ end
0
+ end
0
+end
0
                      
0
 
0
 class SimpleJob
0
@@ -10,7 +17,16 @@ class RandomRubyObject
0
   def say_hello
0
     'hello'
0
   end
0
-end
0
+end
0
+
0
+class ErrorObject
0
+
0
+ def throw
0
+ raise ActiveRecord::RecordNotFound, '...'
0
+ false
0
+ end
0
+
0
+end
0
 
0
 class StoryReader
0
   
0
@@ -20,7 +36,15 @@ class StoryReader
0
   
0
 end
0
 
0
+class StoryReader
0
+
0
+ def read(story)
0
+ "Epilog: #{story.tell}"
0
+ end
0
+
0
+end
0
 
0
+
0
 describe 'random ruby objects' do
0
   
0
   before { reset_db }
0
@@ -48,7 +72,23 @@ describe 'random ruby objects' do
0
     RandomRubyObject.new.send_later(:say_hello)
0
                                
0
     Delayed::Job.count.should == 1
0
- end
0
+ end
0
+
0
+ it "should ignore ActiveRecord::RecordNotFound errors because they are permanent" do
0
+
0
+ ErrorObject.new.send_later(:throw)
0
+
0
+ Delayed::Job.count.should == 1
0
+
0
+ output = nil
0
+
0
+ Delayed::Job.reserve do |e|
0
+ output = e.perform
0
+ end
0
+
0
+ output.should == true
0
+
0
+ end
0
   
0
   it "should store the object as string if its an active record" do
0
     story = Story.create :text => 'Once upon...'
...
17
18
19
20
 
21
22
23
...
17
18
19
 
20
21
22
23
0
@@ -17,7 +17,7 @@ describe Delayed::Job do
0
   end
0
 
0
   it "should set run_at automatically" do
0
- Delayed::Job.create.run_at.should_not == nil
0
+ Delayed::Job.create(:payload_object => ErrorJob.new ).run_at.should_not == nil
0
   end
0
 
0
   it "should raise ArgumentError when handler doesn't respond_to :perform" do

Comments

    No one has commented yet.