topprospect-delayed_job 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,12 +34,10 @@ module Delayed
|
|
|
34
34
|
scope :by_priority, order('priority ASC, run_at ASC')
|
|
35
35
|
else
|
|
36
36
|
named_scope :ready_to_run, lambda {|worker_name, max_run_time|
|
|
37
|
-
|
|
38
37
|
if Worker.queue == Delayed::ALL_QUEUES
|
|
39
|
-
conditions = ['
|
|
38
|
+
conditions = ['locked_at IS NULL AND failed_at IS NULL']
|
|
40
39
|
else
|
|
41
|
-
conditions = ['queue = ? AND
|
|
42
|
-
Worker.queue, db_time_now - max_run_time]
|
|
40
|
+
conditions = ['queue = ? AND locked_at IS NULL AND failed_at IS NULL', Worker.queue]
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
{:conditions => conditions}
|
|
@@ -100,9 +100,9 @@ shared_examples_for 'a backend' do
|
|
|
100
100
|
@backend.find_available('worker', 5, 4.hours).should include(@job)
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
it "should find expired jobs" do
|
|
103
|
+
it "should not find expired jobs" do
|
|
104
104
|
@job = create_job(:locked_by => 'worker', :locked_at => @backend.db_time_now - 2.minutes)
|
|
105
|
-
@backend.find_available('worker', 5, 1.minute).
|
|
105
|
+
@backend.find_available('worker', 5, 1.minute).should_not include(@job)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
#it "should find own jobs" do
|
|
@@ -144,8 +144,8 @@ shared_examples_for 'a backend' do
|
|
|
144
144
|
@backend.find_available('worker2', 1, 6.minutes).length.should == 0
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
it "should be found by another worker if the time has expired" do
|
|
148
|
-
@backend.find_available('worker2', 1, 4.minutes).length.should ==
|
|
147
|
+
it "should not be found by another worker even if the time has expired" do
|
|
148
|
+
@backend.find_available('worker2', 1, 4.minutes).length.should == 0
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
it "should be able to get exclusive access again when the worker name is the same" do
|
data/spec/test.sql3
ADDED
|
Binary file
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: topprospect-delayed_job
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 2.0.
|
|
9
|
+
- 9
|
|
10
|
+
version: 2.0.9
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Chris Gaffney
|
|
@@ -19,7 +19,7 @@ autorequire:
|
|
|
19
19
|
bindir: bin
|
|
20
20
|
cert_chain: []
|
|
21
21
|
|
|
22
|
-
date: 2011-
|
|
22
|
+
date: 2011-10-20 00:00:00 -07:00
|
|
23
23
|
default_executable:
|
|
24
24
|
dependencies:
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
@@ -241,6 +241,7 @@ files:
|
|
|
241
241
|
- spec/setup/data_mapper.rb
|
|
242
242
|
- spec/setup/mongo_mapper.rb
|
|
243
243
|
- spec/spec_helper.rb
|
|
244
|
+
- spec/test.sql3
|
|
244
245
|
- spec/worker_spec.rb
|
|
245
246
|
- rails/init.rb
|
|
246
247
|
- MIT-LICENSE
|
|
@@ -278,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
278
279
|
requirements: []
|
|
279
280
|
|
|
280
281
|
rubyforge_project:
|
|
281
|
-
rubygems_version: 1.
|
|
282
|
+
rubygems_version: 1.3.7
|
|
282
283
|
signing_key:
|
|
283
284
|
specification_version: 3
|
|
284
285
|
summary: Database-backed asynchronous priority queue system -- Extracted from Shopify
|
|
@@ -298,4 +299,5 @@ test_files:
|
|
|
298
299
|
- spec/setup/data_mapper.rb
|
|
299
300
|
- spec/setup/mongo_mapper.rb
|
|
300
301
|
- spec/spec_helper.rb
|
|
302
|
+
- spec/test.sql3
|
|
301
303
|
- spec/worker_spec.rb
|