resque-scheduler 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/lib/resque/scheduler.rb +2 -3
- data/lib/resque_scheduler/server.rb +1 -1
- data/lib/resque_scheduler/version.rb +1 -1
- data/test/delayed_queue_test.rb +14 -2
- metadata +4 -2
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2010 Ben VandenBos
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/lib/resque/scheduler.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rufus-scheduler'
|
2
1
|
require 'rufus/scheduler'
|
3
2
|
require 'thwait'
|
4
3
|
|
@@ -71,7 +70,7 @@ module Resque
|
|
71
70
|
handle_shutdown do
|
72
71
|
if item = Resque.next_item_for_timestamp(timestamp)
|
73
72
|
log "queuing #{item['class']} [delayed]"
|
74
|
-
queue = item['queue'] || queue_from_class(constantize(item['class']))
|
73
|
+
queue = item['queue'] || Resque.queue_from_class(constantize(item['class']))
|
75
74
|
Job.create(queue, item['class'], *item['args'])
|
76
75
|
end
|
77
76
|
end
|
@@ -136,4 +135,4 @@ module Resque
|
|
136
135
|
|
137
136
|
end
|
138
137
|
|
139
|
-
end
|
138
|
+
end
|
data/test/delayed_queue_test.rb
CHANGED
@@ -112,8 +112,20 @@ class Resque::DelayedQueueTest < Test::Unit::TestCase
|
|
112
112
|
Resque.enqueue_at(t, SomeIvarJob)
|
113
113
|
|
114
114
|
# 2 SomeIvarJob jobs should be created in the "ivar" queue
|
115
|
-
Resque::Job.expects(:create).twice.with('ivar', 'SomeIvarJob')
|
116
|
-
Resque
|
115
|
+
Resque::Job.expects(:create).twice.with('ivar', 'SomeIvarJob', nil)
|
116
|
+
Resque.expects(:queue_from_class).never # Should NOT need to load the class
|
117
|
+
Resque::Scheduler.handle_delayed_items
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_works_with_out_specifying_queue__upgrade_case
|
121
|
+
t = Time.now - 60
|
122
|
+
Resque.delayed_push(t, :class => 'SomeIvarJob')
|
123
|
+
|
124
|
+
# Since we didn't specify :queue when calling delayed_push, it will be forced
|
125
|
+
# to load the class to figure out the queue. This is the upgrade case from 1.0.4
|
126
|
+
# to 1.0.5.
|
127
|
+
Resque::Job.expects(:create).once.with(:ivar, 'SomeIvarJob', nil)
|
128
|
+
|
117
129
|
Resque::Scheduler.handle_delayed_items
|
118
130
|
end
|
119
131
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben VandenBos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -62,10 +62,12 @@ executables: []
|
|
62
62
|
extensions: []
|
63
63
|
|
64
64
|
extra_rdoc_files:
|
65
|
+
- LICENSE
|
65
66
|
- README.markdown
|
66
67
|
files:
|
67
68
|
- .gitignore
|
68
69
|
- HISTORY.md
|
70
|
+
- LICENSE
|
69
71
|
- README.markdown
|
70
72
|
- Rakefile
|
71
73
|
- lib/resque/scheduler.rb
|