quebert 1.11.0 → 1.12.0
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/quebert/job.rb +8 -2
- data/lib/quebert/version.rb +1 -1
- data/spec/job_spec.rb +17 -1
- metadata +5 -7
data/lib/quebert/job.rb
CHANGED
@@ -7,7 +7,13 @@ module Quebert
|
|
7
7
|
attr_reader :args
|
8
8
|
attr_accessor :priority, :delay, :ttr
|
9
9
|
|
10
|
-
|
10
|
+
# Prioritize Quebert jobs as specified in https://github.com/kr/beanstalkd/blob/master/doc/protocol.txt.
|
11
|
+
class Priority
|
12
|
+
LOW = 2**32
|
13
|
+
MEDIUM = LOW / 2
|
14
|
+
HIGH = 0
|
15
|
+
end
|
16
|
+
|
11
17
|
DEFAULT_JOB_DELAY = 0
|
12
18
|
DEFAULT_JOB_TTR = 10
|
13
19
|
|
@@ -29,7 +35,7 @@ module Quebert
|
|
29
35
|
def initialize(*args)
|
30
36
|
opts = args.last.is_a?(::Hash) ? args.pop : nil
|
31
37
|
|
32
|
-
@priority =
|
38
|
+
@priority = Job::Priority::MEDIUM
|
33
39
|
@delay = DEFAULT_JOB_DELAY
|
34
40
|
@ttr = DEFAULT_JOB_TTR
|
35
41
|
|
data/lib/quebert/version.rb
CHANGED
data/spec/job_spec.rb
CHANGED
@@ -27,7 +27,23 @@ describe Quebert::Job do
|
|
27
27
|
unserialized.should be_instance_of(Adder)
|
28
28
|
unserialized.args.should eql(args)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
|
+
it "should have default MEDIUM priority" do
|
32
|
+
Job.new.priority.should == Quebert::Job::Priority::MEDIUM
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "Quebert::Job::Priority" do
|
36
|
+
it "should have LOW priority of 4294967296" do
|
37
|
+
Quebert::Job::Priority::LOW.should == 4294967296
|
38
|
+
end
|
39
|
+
it "should have MEDIUM priority of 2147483648" do
|
40
|
+
Quebert::Job::Priority::MEDIUM.should == 2147483648
|
41
|
+
end
|
42
|
+
it "should have HIGH priority of 0" do
|
43
|
+
Quebert::Job::Priority::HIGH.should == 0
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
context "actions" do
|
32
48
|
it "should raise release" do
|
33
49
|
lambda{
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quebert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 39
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 12
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.12.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brad Gessler
|
@@ -17,8 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date:
|
21
|
-
default_executable:
|
20
|
+
date: 2013-03-20 00:00:00 Z
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
24
23
|
name: json
|
@@ -122,7 +121,6 @@ files:
|
|
122
121
|
- spec/support/jobs.rb
|
123
122
|
- spec/support_spec.rb
|
124
123
|
- spec/worker_spec.rb
|
125
|
-
has_rdoc: true
|
126
124
|
homepage: http://github.com/polleverywhere/quebert
|
127
125
|
licenses: []
|
128
126
|
|
@@ -152,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
150
|
requirements: []
|
153
151
|
|
154
152
|
rubyforge_project: quebert
|
155
|
-
rubygems_version: 1.
|
153
|
+
rubygems_version: 1.8.24
|
156
154
|
signing_key:
|
157
155
|
specification_version: 3
|
158
156
|
summary: A worker queue framework built around beanstalkd
|