circuit_breaker 1.1.0 → 1.1.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 878d179cb18117bfd31851db4290e31a051e0631
4
+ data.tar.gz: f03a183efddb0c5a6106100f8d7bf9f5e6489f5b
5
+ SHA512:
6
+ metadata.gz: 32ddfd097a904c51224efcd2f9c3b4cade17383d6ea749dbc21cff16f5b87b97664c69529a196244f980ea1125d5cc63fff6913fce3439a5cf2914e238ad2a0c
7
+ data.tar.gz: 9105785a5f0b372816d12afae455c70c1937608919e38671a41d26a46259c49750c86ffb72783b6f0758f044a95c045224b7bfde72b06833ea0a3e1de9e1552e
@@ -1,3 +1,8 @@
1
+ === 1.1.1 / 2014-03-06
2
+
3
+ * Fix for how exceptions are handled in timeout / 9ae32e2 (mswain)
4
+ * Fix for deprecated AASM methods (AASM 4.0.0 uses new ones) / #5 (celiofonseca)
5
+
1
6
  === 1.1.0 / 2013-04-18
2
7
 
3
8
  * Feature to ignore specified exceptions (wandenberg)
@@ -5,7 +5,7 @@ require 'circuit_breaker/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{circuit_breaker}
7
7
  s.version = CircuitBreaker::VERSION
8
- s.date = %q{2013-04-13}
8
+ s.date = %q{2014-03-06}
9
9
 
10
10
  s.authors = ["Will Sargent"]
11
11
  s.email = ["will.sargent@gmail.com"]
@@ -1,6 +1,6 @@
1
1
  class CircuitBreaker::CircuitBrokenException < StandardError
2
2
 
3
- def initialize(msg, circuit_state = :closed)
3
+ def initialize(msg = nil, circuit_state = :closed)
4
4
  @circuit_state = circuit_state
5
5
  super(msg)
6
6
  end
@@ -9,32 +9,32 @@ class CircuitBreaker::CircuitState
9
9
 
10
10
  include AASM
11
11
 
12
- aasm_state :half_open
12
+ aasm.state :half_open
13
13
 
14
- aasm_state :open
14
+ aasm.state :open
15
15
 
16
- aasm_state :closed, :enter => :reset_failure_count
16
+ aasm.state :closed, :enter => :reset_failure_count
17
17
 
18
- aasm_initial_state :closed
18
+ aasm.initial_state :closed
19
19
 
20
20
  #
21
21
  # Trips the circuit breaker into the open state where it will immediately fail.
22
22
  #
23
- aasm_event :trip do
23
+ aasm.event :trip do
24
24
  transitions :to => :open, :from => [:closed, :half_open]
25
25
  end
26
26
 
27
27
  #
28
28
  # Transitions from an open state to a half_open state.
29
29
  #
30
- aasm_event :attempt_reset do
30
+ aasm.event :attempt_reset do
31
31
  transitions :to => :half_open, :from => [:open]
32
32
  end
33
33
 
34
34
  #
35
35
  # Close the circuit from an open or half open state.
36
36
  #
37
- aasm_event :reset do
37
+ aasm.event :reset do
38
38
  transitions :to => :closed, :from => [:open, :half_open]
39
39
  end
40
40
 
@@ -1,3 +1,3 @@
1
1
  module CircuitBreaker
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,79 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circuit_breaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Will Sargent
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-13 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: aasm
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
- description: ! "CircuitBreaker is a relatively simple Ruby mixin that will wrap\n
63
- a call to a given service in a circuit breaker pattern.\n\n The circuit starts off
64
- \"closed\" meaning that all calls will go through.\n However, consecutive failures
65
- are recorded and after a threshold is reached,\n the circuit will \"trip\", setting
66
- the circuit into an \"open\" state.\n\n In an \"open\" state, every call to the
67
- service will fail by raising\n CircuitBrokenException.\n\n The circuit will remain
68
- in an \"open\" state until the failure timeout has\n elapsed.\n\n After the failure_timeout
69
- has elapsed, the circuit will go into\n a \"half open\" state and the call will
70
- go through. A failure will\n immediately pop the circuit open again, and a success
71
- will close the\n circuit and reset the failure count.\n\n require 'circuit_breaker'\n
72
- \ class TestService\n\n include CircuitBreaker\n\n def call_remote_service()
73
- ...\n\n circuit_method :call_remote_service\n\n # Optional\n circuit_handler
74
- do |handler|\n handler.logger = Logger.new(STDOUT)\n handler.failure_threshold
75
- = 5\n handler.failure_timeout = 5\n end\n\n # Optional\n circuit_handler_class
76
- MyCustomCircuitHandler\n end"
55
+ description: |-
56
+ CircuitBreaker is a relatively simple Ruby mixin that will wrap
57
+ a call to a given service in a circuit breaker pattern.
58
+
59
+ The circuit starts off "closed" meaning that all calls will go through.
60
+ However, consecutive failures are recorded and after a threshold is reached,
61
+ the circuit will "trip", setting the circuit into an "open" state.
62
+
63
+ In an "open" state, every call to the service will fail by raising
64
+ CircuitBrokenException.
65
+
66
+ The circuit will remain in an "open" state until the failure timeout has
67
+ elapsed.
68
+
69
+ After the failure_timeout has elapsed, the circuit will go into
70
+ a "half open" state and the call will go through. A failure will
71
+ immediately pop the circuit open again, and a success will close the
72
+ circuit and reset the failure count.
73
+
74
+ require 'circuit_breaker'
75
+ class TestService
76
+
77
+ include CircuitBreaker
78
+
79
+ def call_remote_service() ...
80
+
81
+ circuit_method :call_remote_service
82
+
83
+ # Optional
84
+ circuit_handler do |handler|
85
+ handler.logger = Logger.new(STDOUT)
86
+ handler.failure_threshold = 5
87
+ handler.failure_timeout = 5
88
+ end
89
+
90
+ # Optional
91
+ circuit_handler_class MyCustomCircuitHandler
92
+ end
77
93
  email:
78
94
  - will.sargent@gmail.com
79
95
  executables: []
@@ -98,6 +114,7 @@ files:
98
114
  - spec/spec_helper.rb
99
115
  homepage: http://github.com/wsargent/circuit_breaker
100
116
  licenses: []
117
+ metadata: {}
101
118
  post_install_message:
102
119
  rdoc_options:
103
120
  - --main
@@ -106,22 +123,20 @@ rdoc_options:
106
123
  require_paths:
107
124
  - lib
108
125
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
126
  requirements:
111
- - - ! '>='
127
+ - - '>='
112
128
  - !ruby/object:Gem::Version
113
129
  version: '0'
114
130
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
131
  requirements:
117
- - - ! '>='
132
+ - - '>='
118
133
  - !ruby/object:Gem::Version
119
134
  version: '0'
120
135
  requirements: []
121
136
  rubyforge_project: will_sargent
122
- rubygems_version: 1.8.23
137
+ rubygems_version: 2.0.3
123
138
  signing_key:
124
- specification_version: 3
139
+ specification_version: 4
125
140
  summary: CircuitBreaker is a relatively simple Ruby mixin that will wrap a call to
126
141
  a given service in a circuit breaker pattern
127
142
  test_files: