protoboard 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 175b3b992b54ff76843bfe76a7620697cd23e9bd
4
- data.tar.gz: cd9019c9ca9d549a474a5c81f5a1589007d4d771
3
+ metadata.gz: e01a1ea9dda4c4cb8c9b89cfef74bb3d00431dad
4
+ data.tar.gz: d92e50f697b6a174de88956170951bbf7627a79a
5
5
  SHA512:
6
- metadata.gz: bcd43fe58d6220e9aac388a51554b588c7cefd741466d0a2b6574c0b678fc324552974a4df3d4b90b7285a9e947c1dcc3b577dde73182bec670c30a47f1e44c2
7
- data.tar.gz: f1cf6e3833ceac3ef295c424dcd3932769a6888340bf04b389237a915ac162388b24ac78567c530ebeed7fd480ece6bbe07fa662e140a08c42295f3aecf83879
6
+ metadata.gz: 57e78d10df3b84a5cce7320d6142515d4eb7bfd866479de0b0d6641e8092ade1c115b35ff50e10842a71d21ad095a8d758d149776488729c92b1fb872a56c6e5
7
+ data.tar.gz: 36aeb19a4a4fd7a61448a8236974bb65b8fadd00aedecb80bb821e911d70b4f3c6868538926147d9ad87f215da238bb5e63385a5b72223dd65fbfecaf069aa0b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- protoboard (0.1.2)
4
+ protoboard (0.1.3)
5
5
  dry-configurable (~> 0.7.0)
6
6
  stoplight (~> 2.1.3)
7
7
 
data/README.md CHANGED
@@ -30,11 +30,12 @@ class MyFooService
30
30
  include Protoboard::CircuitBreaker
31
31
 
32
32
  register_circuits [:some_method],
33
- options: {
34
- service: 'my_cool_service',
35
- open_after: 2,
36
- cool_off_after: 3
37
- }
33
+ options: {
34
+ service: 'my_cool_service',
35
+ open_after: 2,
36
+ cool_off_after: 3
37
+ }
38
+
38
39
  def some_method
39
40
  # Something that can break
40
41
  end
@@ -48,14 +49,14 @@ class MyFooService
48
49
  include Protoboard::CircuitBreaker
49
50
 
50
51
  register_circuits [:some_method],
51
- fallback: -> (error) { 'Do Something' }
52
- on_before: [->(ce) { Something.notify("Circuit #{ce.circuit.name}") }, ->(_) {}],
53
- on_after: [->(ce) { Something.notify("It fails with #{ce.error}") if ce.fail? }],
54
- options: {
55
- service: 'my_cool_service',
56
- open_after: 2,
57
- cool_off_after: 3
58
- }
52
+ fallback: -> (error) { 'Do Something' }
53
+ on_before: [->(ce) { Something.notify("Circuit #{ce.circuit.name}") }, ->(_) {}],
54
+ on_after: [->(ce) { Something.notify("It fails with #{ce.error}") if ce.fail? }],
55
+ options: {
56
+ service: 'my_cool_service',
57
+ open_after: 2,
58
+ cool_off_after: 3
59
+ }
59
60
  def some_method
60
61
  # Something that can break
61
62
  end
@@ -119,6 +120,7 @@ In configuration you can customize the adapter options and set callbacks and con
119
120
 
120
121
  Protoboard.configure do |config|
121
122
  config.adapter = Protoboard::Adapters::StoplightAdapter
123
+ config.namespace = 'Foo'
122
124
 
123
125
  config.adapter.configure do |adapter|
124
126
  adapter.data_store = :redis # Default is :memory
@@ -136,6 +138,7 @@ end
136
138
  The available options are:
137
139
 
138
140
  * `adapter =` Sets the adapter, `Protoboard::Adapters::StoplightAdapter` is the default
141
+ * `namespace =` It's used to name the circuit avoiding naming colision with other projects
139
142
  * `callbacks.before =` Receives an array of callables, lambdas, procs or any object that responds to `call` and receives one argument. It will be called before each circuit execution.
140
143
  * `callbacks.after =` Receives an array of callables, lambdas, procs or any object that responds to `call` and receives one argument. It will be called after each circuit execution.
141
144
 
@@ -17,7 +17,7 @@ module Protoboard
17
17
  # * +options+ - A hash containing the options needed for the circuit to execute
18
18
  # * +:service+ - A string representing the name of the service for the circuit
19
19
  # * +:open_after+ - An integer representing the number of errors to occur for the circuit to be opened
20
- # * +:cool_off_after+ - An integer representing the number of successful requests to occur for the circuit to be closed
20
+ # * +:cool_off_after+ - An integer representing the time in seconds for the circuit to attempt to recover
21
21
  #
22
22
  # ==== Example
23
23
  # options: {
@@ -33,7 +33,7 @@ module Protoboard
33
33
  { service => { 'circuits' => circuits } }
34
34
  end.reduce(:merge)
35
35
 
36
- { 'services' => services_hash }
36
+ { 'services' => services_hash.to_h }
37
37
  end
38
38
  end
39
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Protoboard
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protoboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Atkinson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-06-05 00:00:00.000000000 Z
12
+ date: 2018-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-configurable