resque-status 0.2.2 → 0.2.3
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.
- data/lib/resque/job_with_status.rb +2 -2
- data/lib/resque/status.rb +2 -7
- data/resque-status.gemspec +2 -2
- data/test/test_resque-job_with_status.rb +14 -0
- data/test/test_resque-status.rb +2 -2
- metadata +3 -3
@@ -93,7 +93,7 @@ module Resque
|
|
93
93
|
# This is needed to be used with resque scheduler
|
94
94
|
# http://github.com/bvandenbos/resque-scheduler
|
95
95
|
def self.scheduled(queue, klass, *args)
|
96
|
-
create(args)
|
96
|
+
create(*args)
|
97
97
|
end
|
98
98
|
|
99
99
|
# Create a new instance with <tt>uuid</tt> and <tt>options</tt>
|
@@ -142,7 +142,7 @@ module Resque
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def name
|
145
|
-
"#{self.class.name}(#{options unless options.empty?})"
|
145
|
+
"#{self.class.name}(#{options.inspect unless options.empty?})"
|
146
146
|
end
|
147
147
|
|
148
148
|
# Checks against the kill list if this specific job instance should be killed
|
data/lib/resque/status.rb
CHANGED
@@ -7,7 +7,7 @@ module Resque
|
|
7
7
|
# the common status attributes. It also has a number of class methods for
|
8
8
|
# creating/updating/retrieving status objects from Redis
|
9
9
|
class Status < Hash
|
10
|
-
VERSION = '0.2.
|
10
|
+
VERSION = '0.2.3'
|
11
11
|
|
12
12
|
extend Resque::Helpers
|
13
13
|
|
@@ -82,12 +82,7 @@ module Resque
|
|
82
82
|
# Because we want a reverse chronological order, we need to get a range starting
|
83
83
|
# by the higest negative number. The ordering is transparent from the API user's
|
84
84
|
# perspective so we need to convert the passed params
|
85
|
-
|
86
|
-
range_start = -1
|
87
|
-
else
|
88
|
-
range_end -= 1
|
89
|
-
end
|
90
|
-
(redis.zrevrange(set_key, -(range_end.abs), -(range_start.abs)) || []).reverse
|
85
|
+
(redis.zrevrange(set_key, (range_start.abs), ((range_end || 1).abs)) || [])
|
91
86
|
end
|
92
87
|
end
|
93
88
|
|
data/resque-status.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{resque-status}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aaron Quint"]
|
12
|
-
s.date = %q{2011-02
|
12
|
+
s.date = %q{2011-04-02}
|
13
13
|
s.description = %q{resque-status is an extension to the resque queue system that provides simple trackable jobs. It provides a Resque::Status class which can set/get the statuses of jobs and a Resque::JobWithStatus class that when subclassed provides easily trackable/killable jobs.}
|
14
14
|
s.email = %q{aaron@quirkey.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,6 +32,20 @@ class TestResqueJobWithStatus < Test::Unit::TestCase
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
+
context ".scheduled" do
|
36
|
+
setup do
|
37
|
+
@job_args = {'num' => 100}
|
38
|
+
@uuid = WorkingJob.scheduled(:queue_name, WorkingJob, @job_args)
|
39
|
+
end
|
40
|
+
|
41
|
+
should "create the job with the provided arguments" do
|
42
|
+
|
43
|
+
job = Resque.pop(:statused)
|
44
|
+
|
45
|
+
assert_equal @job_args, job['args'].last
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
35
49
|
context ".enqueue" do
|
36
50
|
setup do
|
37
51
|
@uuid = Resque::JobWithStatus.enqueue(WorkingJob, :num => 100)
|
data/test/test_resque-status.rb
CHANGED
@@ -107,8 +107,8 @@ class TestResqueStatus < Test::Unit::TestCase
|
|
107
107
|
end
|
108
108
|
|
109
109
|
should "let you paginate through the statuses" do
|
110
|
-
assert_equal Resque::Status.status_ids
|
111
|
-
assert_equal Resque::Status.status_ids
|
110
|
+
assert_equal Resque::Status.status_ids[0, 10], Resque::Status.status_ids(0, 9)
|
111
|
+
assert_equal Resque::Status.status_ids[10, 10], Resque::Status.status_ids(10, 19)
|
112
112
|
# assert_equal Resque::Status.status_ids.reverse[0, 10], Resque::Status.status_ids(0, 10)
|
113
113
|
end
|
114
114
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Aaron Quint
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02
|
17
|
+
date: 2011-04-02 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|