kestrel-client 0.5.8 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/kestrel-client.gemspec +2 -2
- data/lib/kestrel/client/transactional.rb +14 -3
- data/spec/kestrel/client/transactional_spec.rb +2 -2
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/kestrel-client.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kestrel-client}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Freels", "Rael Dornfest"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-07}
|
13
13
|
s.description = %q{Ruby client for the Kestrel queue server}
|
14
14
|
s.email = %q{rael@twitter.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -8,6 +8,13 @@ class Kestrel::Client::Transactional < Kestrel::Client::Proxy
|
|
8
8
|
# there is no current open transaction
|
9
9
|
class NoOpenTransaction < StandardError; end
|
10
10
|
|
11
|
+
# Raised when a retry fails when max retries is exceeded
|
12
|
+
class RetriesExceeded < StandardError
|
13
|
+
def initialize(job)
|
14
|
+
super "Max retries of #{job.retries} exceeded for item: #{job.job.inspect}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
class RetryableJob < Struct.new(:retries, :job); end
|
12
19
|
|
13
20
|
# Number of times to retry a job before giving up
|
@@ -94,10 +101,14 @@ class Kestrel::Client::Transactional < Kestrel::Client::Proxy
|
|
94
101
|
|
95
102
|
job.retries += 1
|
96
103
|
|
97
|
-
|
98
|
-
|
104
|
+
if job.retries < @max_retries
|
105
|
+
client.set(current_queue + "_errors", job)
|
106
|
+
else
|
107
|
+
raise RetriesExceeded.new(job)
|
108
|
+
end
|
99
109
|
|
100
|
-
|
110
|
+
ensure
|
111
|
+
close_last_transaction
|
101
112
|
end
|
102
113
|
|
103
114
|
private
|
@@ -83,7 +83,7 @@ describe "Kestrel::Client::Transactional" do
|
|
83
83
|
get_job.should == :mcguffin
|
84
84
|
@kestrel.current_try.should == Kestrel::Client::Transactional::DEFAULT_RETRIES
|
85
85
|
|
86
|
-
@kestrel.retry
|
86
|
+
lambda { @kestrel.retry }.should raise_error(Kestrel::Client::Transactional::RetriesExceeded)
|
87
87
|
@kestrel.get(@queue) # simulate next get run
|
88
88
|
end
|
89
89
|
end
|
@@ -207,7 +207,7 @@ describe "Kestrel::Client::Transactional" do
|
|
207
207
|
mock(@raw_kestrel_client).set(@queue + "_errors", anything).never
|
208
208
|
mock(@raw_kestrel_client).get_from_last(@queue + "_errors/close")
|
209
209
|
@kestrel.get(@queue)
|
210
|
-
@kestrel.retry.should
|
210
|
+
lambda { @kestrel.retry }.should raise_error(Kestrel::Client::Transactional::RetriesExceeded)
|
211
211
|
end
|
212
212
|
|
213
213
|
it "closes an open transaction with no retries" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kestrel-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Freels
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-07 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|