gizzmo 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.10.0
data/gizzmo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gizzmo}
8
- s.version = "0.9.0"
8
+ s.version = "0.10.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyle Maxwell"]
12
- s.date = %q{2010-11-01}
12
+ s.date = %q{2010-11-02}
13
13
  s.default_executable = %q{gizzmo}
14
14
  s.description = %q{Gizzmo is a command-line client for managing gizzard clusters.}
15
15
  s.email = %q{kmaxwell@twitter.com}
@@ -41,16 +41,37 @@ module Gizzard
41
41
  end
42
42
  end
43
43
  end
44
+
45
+ class RetryProxy
46
+ def initialize(retries, object)
47
+ @inner = object
48
+ @retries_left = retries
49
+ end
50
+
51
+ def method_missing(*args)
52
+ @inner.send(*args)
53
+ rescue
54
+ if @retries_left > 0
55
+ @retries_left -= 1
56
+ STDERR.puts "Retrying..."
57
+ method_missing(*args)
58
+ else
59
+ raise
60
+ end
61
+ end
62
+ end
44
63
 
45
64
  class ShardCommand < Command
46
65
  def self.make_service(global_options, log)
47
- Gizzard::Thrift::ShardManager.new(global_options.host, global_options.port, log, global_options.dry)
66
+ RetryProxy.new global_options.retry.to_i,
67
+ Gizzard::Thrift::ShardManager.new(global_options.host, global_options.port, log, global_options.dry)
48
68
  end
49
69
  end
50
70
 
51
71
  class JobCommand < Command
52
72
  def self.make_service(global_options, log)
53
- Gizzard::Thrift::JobManager.new(global_options.host, global_options.port + 2, log, global_options.dry)
73
+ RetryProxy.new global_options.retry.to_i ,
74
+ Gizzard::Thrift::JobManager.new(global_options.host, global_options.port + 2, log, global_options.dry)
54
75
  end
55
76
  end
56
77
 
data/lib/gizzmo.rb CHANGED
@@ -370,21 +370,9 @@ def custom_timeout(seconds)
370
370
  end
371
371
  end
372
372
 
373
- tries_left = global_options.retry.to_i + 1
374
- begin
375
- while (tries_left -= 1) >= 0
376
- begin
377
- custom_timeout(global_options.timeout) do
378
- Gizzard::Command.run(subcommand_name, global_options, argv, subcommand_options, log)
379
- end
380
- break
381
- rescue
382
- if tries_left > 0
383
- STDERR.puts "Retrying..."
384
- else
385
- raise
386
- end
387
- end
373
+ begin
374
+ custom_timeout(global_options.timeout) do
375
+ Gizzard::Command.run(subcommand_name, global_options, argv, subcommand_options, log)
388
376
  end
389
377
  rescue HelpNeededError => e
390
378
  if e.class.name != e.message
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 9
7
+ - 10
8
8
  - 0
9
- version: 0.9.0
9
+ version: 0.10.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kyle Maxwell
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-01 00:00:00 -07:00
17
+ date: 2010-11-02 00:00:00 -07:00
18
18
  default_executable: gizzmo
19
19
  dependencies: []
20
20