quebert 1.0.1 → 1.0.2
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/{spec/spec.opts → .rspec} +0 -0
- data/Gemfile +2 -2
- data/lib/quebert.rb +1 -1
- data/lib/quebert/async_sender/instance.rb +1 -1
- data/lib/quebert/backend/beanstalk.rb +4 -1
- data/lib/quebert/controller/beanstalk.rb +1 -1
- data/lib/quebert/job.rb +6 -1
- data/lib/quebert/logging.rb +1 -3
- data/lib/quebert/version.rb +1 -1
- data/quebert.gemspec +1 -1
- data/spec/async_sender_spec.rb +2 -2
- data/spec/backend_spec.rb +1 -1
- data/spec/command_line_runner_spec.rb +2 -2
- data/spec/configuration_spec.rb +2 -2
- data/spec/consumer_spec.rb +3 -3
- data/spec/job_spec.rb +3 -3
- data/spec/quebert_spec.rb +1 -1
- data/spec/serializer_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -5
- data/spec/support/jobs.rb +2 -3
- data/spec/support_spec.rb +1 -1
- data/spec/worker_spec.rb +1 -1
- metadata +10 -13
data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|
data/Gemfile
CHANGED
@@ -8,8 +8,8 @@ group :development do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
group :test do
|
11
|
-
gem 'ruby-debug', :platform => :ruby_18
|
12
|
-
gem 'ruby-debug19', :platform => :ruby_19
|
11
|
+
# gem 'ruby-debug', :platform => :ruby_18
|
12
|
+
# gem 'ruby-debug19', :platform => :ruby_19
|
13
13
|
gem 'activerecord', '2.3.5'
|
14
14
|
gem 'sqlite3-ruby'
|
15
15
|
gem 'guard-rspec'
|
data/lib/quebert.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'quebert/version'
|
2
2
|
|
3
3
|
module Quebert
|
4
|
+
autoload :Logging, 'quebert/logging'
|
4
5
|
autoload :Serializer, 'quebert/serializer'
|
5
6
|
autoload :Configuration, 'quebert/configuration'
|
6
7
|
autoload :Timeout, 'quebert/timeout'
|
7
|
-
autoload :Logging, 'quebert/logging'
|
8
8
|
autoload :Job, 'quebert/job'
|
9
9
|
autoload :Controller, 'quebert/controller'
|
10
10
|
autoload :Backend, 'quebert/backend'
|
@@ -29,8 +29,11 @@ module Quebert
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
def initialize(host, *args)
|
33
|
+
super Array(host), *args
|
34
|
+
end
|
32
35
|
def self.configure(opts={})
|
33
|
-
opts[:host] ||= '127.0.0.1:11300'
|
36
|
+
opts[:host] ||= ['127.0.0.1:11300']
|
34
37
|
new(opts[:host], opts[:tube])
|
35
38
|
end
|
36
39
|
end
|
@@ -68,7 +68,7 @@ module Quebert
|
|
68
68
|
protected
|
69
69
|
def retry_with_delay
|
70
70
|
delay = TIMEOUT_RETRY_DELAY_SEED + TIMEOUT_RETRY_GROWTH_RATE**beanstalk_job.stats["releases"].to_i
|
71
|
-
|
71
|
+
|
72
72
|
if delay > MAX_TIMEOUT_RETRY_DELAY
|
73
73
|
beanstalk_job.bury
|
74
74
|
log "Max retry delay exceeded. Burrying job."
|
data/lib/quebert/job.rb
CHANGED
@@ -11,6 +11,11 @@ module Quebert
|
|
11
11
|
DEFAULT_JOB_DELAY = 0
|
12
12
|
DEFAULT_JOB_TTR = 10
|
13
13
|
|
14
|
+
# A buffer time in seconds added to the Beanstalk TTR for Quebert to do its own job cleanup
|
15
|
+
# The job will perform based on the Beanstalk TTR, but Beanstalk hangs on to the job just a
|
16
|
+
# little longer so that Quebert can bury the job or schedule a retry with the appropriate delay
|
17
|
+
QUEBERT_TTR_BUFFER = 1
|
18
|
+
|
14
19
|
NotImplemented = Class.new(StandardError)
|
15
20
|
|
16
21
|
Action = Class.new(Exception)
|
@@ -58,7 +63,7 @@ module Quebert
|
|
58
63
|
end
|
59
64
|
|
60
65
|
def enqueue
|
61
|
-
self.class.backend.put self, @priority, @delay, @ttr
|
66
|
+
self.class.backend.put self, @priority, @delay, @ttr + QUEBERT_TTR_BUFFER
|
62
67
|
end
|
63
68
|
|
64
69
|
def to_json
|
data/lib/quebert/logging.rb
CHANGED
data/lib/quebert/version.rb
CHANGED
data/quebert.gemspec
CHANGED
data/spec/async_sender_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe AsyncSender::Class do
|
4
4
|
|
@@ -31,7 +31,7 @@ describe AsyncSender::Class do
|
|
31
31
|
|
32
32
|
it "should async send instance methods" do
|
33
33
|
Greeter.new("brad").async_send(:hi, 'stunning')
|
34
|
-
@q.reserve.perform.should eql(Greeter.new("brad").
|
34
|
+
@q.reserve.perform.should eql(Greeter.new("brad").hi('stunning'))
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
data/spec/backend_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe CommandLineRunner do
|
4
4
|
before(:all) do
|
@@ -53,7 +53,7 @@ describe CommandLineRunner do
|
|
53
53
|
it "should run config file" do
|
54
54
|
clean_file './super_awesome.rb', "raise 'SuperAwesome'" do
|
55
55
|
lambda{
|
56
|
-
CommandLineRunner.dispatch(%w(worker --config super_awesome.rb))
|
56
|
+
CommandLineRunner.dispatch(%w(worker --config ./super_awesome.rb))
|
57
57
|
}.should raise_exception('SuperAwesome')
|
58
58
|
end
|
59
59
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Configuration do
|
4
4
|
context "from hash" do
|
@@ -10,7 +10,7 @@ describe Configuration do
|
|
10
10
|
backend = @config.backend
|
11
11
|
backend.should be_instance_of(Quebert::Backend::Beanstalk)
|
12
12
|
# Blech, gross nastiness in their lib, but we need to look in to see if this stuff as configed
|
13
|
-
backend.instance_variable_get('@addrs').should eql('localhost:11300')
|
13
|
+
backend.instance_variable_get('@addrs').should eql(['localhost:11300'])
|
14
14
|
backend.instance_variable_get('@default_tube').should eql('quebert-config-test')
|
15
15
|
end
|
16
16
|
|
data/spec/consumer_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require 'ruby-debug'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
3
|
describe Controller::Base do
|
5
4
|
it "should perform job" do
|
@@ -73,7 +72,8 @@ describe Controller::Beanstalk do
|
|
73
72
|
end
|
74
73
|
|
75
74
|
it "should retry a job with a delay and then bury" do
|
76
|
-
@q
|
75
|
+
TimeoutJob.backend = @q
|
76
|
+
TimeoutJob.new.enqueue
|
77
77
|
@q.peek_ready.should_not be_nil
|
78
78
|
job = @q.reserve
|
79
79
|
job.beanstalk_job.stats["releases"].should eql(0)
|
data/spec/job_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Quebert::Job do
|
4
4
|
|
@@ -73,7 +73,7 @@ describe Quebert::Job do
|
|
73
73
|
job = @q.reserve
|
74
74
|
job.beanstalk_job.pri.should eql(1)
|
75
75
|
job.beanstalk_job.delay.should eql(2)
|
76
|
-
job.beanstalk_job.ttr.should eql(300)
|
76
|
+
job.beanstalk_job.ttr.should eql(300 + Job::QUEBERT_TTR_BUFFER)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should enqueue and honor beanstalk options" do
|
@@ -81,7 +81,7 @@ describe Quebert::Job do
|
|
81
81
|
job = @q.reserve
|
82
82
|
job.beanstalk_job.pri.should eql(1)
|
83
83
|
job.beanstalk_job.delay.should eql(2)
|
84
|
-
job.beanstalk_job.ttr.should eql(300)
|
84
|
+
job.beanstalk_job.ttr.should eql(300 + Job::QUEBERT_TTR_BUFFER)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
data/spec/quebert_spec.rb
CHANGED
data/spec/serializer_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -5,13 +5,9 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
5
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
6
|
|
7
7
|
require 'quebert'
|
8
|
-
require '
|
9
|
-
require 'spec/autorun'
|
8
|
+
require 'quebert/logging'
|
10
9
|
require 'logger'
|
11
10
|
|
12
|
-
Spec::Runner.configure do |config|
|
13
|
-
end
|
14
|
-
|
15
11
|
include Quebert
|
16
12
|
Quebert.config.logger = Logger.new('/dev/null') # Shhh...
|
17
13
|
|
data/spec/support/jobs.rb
CHANGED
data/spec/support_spec.rb
CHANGED
data/spec/worker_spec.rb
CHANGED
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: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
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: 2012-
|
21
|
-
default_executable:
|
20
|
+
date: 2012-04-10 00:00:00 Z
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
24
23
|
name: json
|
@@ -56,12 +55,12 @@ dependencies:
|
|
56
55
|
requirements:
|
57
56
|
- - "="
|
58
57
|
- !ruby/object:Gem::Version
|
59
|
-
hash:
|
58
|
+
hash: 19
|
60
59
|
segments:
|
61
|
-
-
|
62
|
-
-
|
60
|
+
- 2
|
61
|
+
- 7
|
63
62
|
- 0
|
64
|
-
version:
|
63
|
+
version: 2.7.0
|
65
64
|
type: :development
|
66
65
|
version_requirements: *id003
|
67
66
|
description: A worker queue framework built around beanstalkd
|
@@ -77,6 +76,7 @@ files:
|
|
77
76
|
- .document
|
78
77
|
- .gitignore
|
79
78
|
- .rbenv-version
|
79
|
+
- .rspec
|
80
80
|
- Gemfile
|
81
81
|
- Guardfile
|
82
82
|
- LICENSE
|
@@ -116,13 +116,11 @@ files:
|
|
116
116
|
- spec/job_spec.rb
|
117
117
|
- spec/quebert_spec.rb
|
118
118
|
- spec/serializer_spec.rb
|
119
|
-
- spec/spec.opts
|
120
119
|
- spec/spec_helper.rb
|
121
120
|
- spec/support/active_record.rb
|
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.21
|
156
154
|
signing_key:
|
157
155
|
specification_version: 3
|
158
156
|
summary: A worker queue framework built around beanstalkd
|
@@ -165,7 +163,6 @@ test_files:
|
|
165
163
|
- spec/job_spec.rb
|
166
164
|
- spec/quebert_spec.rb
|
167
165
|
- spec/serializer_spec.rb
|
168
|
-
- spec/spec.opts
|
169
166
|
- spec/spec_helper.rb
|
170
167
|
- spec/support/active_record.rb
|
171
168
|
- spec/support/jobs.rb
|