sc4ry 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sc4ry/circuits.rb +6 -1
- data/lib/sc4ry/dependencies.rb +2 -0
- data/lib/sc4ry/exceptions.rb +6 -0
- data/lib/sc4ry/run_controller.rb +6 -1
- data/lib/sc4ry/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cc6197c11f5b2946c2a7d7ac2057de82866228b4628f5b2d3c0613a3c821ca2
|
4
|
+
data.tar.gz: 306af4cfc3217b7ccc174b9f93407a995faad9fd691b83b0c6848a620313647f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d501193d93a2c0fca6db0b0d7429ff00510253f741347a03a6c6b26b872acb24cb14490ea8a9a61e8b768fce541fbda8c56555e2ba940a1bebe225c4b9065c9b
|
7
|
+
data.tar.gz: e7416163124dee124d7573f37cd2ef51f7d8152105727d057256b5b6738435ab28949c2ebfd5ff5a0d5604b20b40dad32b1ff5f755e3b0b0ab26409b605c710a
|
data/lib/sc4ry/circuits.rb
CHANGED
@@ -11,6 +11,8 @@ module Sc4ry
|
|
11
11
|
:max_overtime_count => 3,
|
12
12
|
:check_delay => 30,
|
13
13
|
:notifiers => [],
|
14
|
+
:forward_unknown_exceptions => true,
|
15
|
+
:raise_on_opening => false,
|
14
16
|
:exceptions => [StandardError, RuntimeError]
|
15
17
|
}
|
16
18
|
|
@@ -86,7 +88,10 @@ module Sc4ry
|
|
86
88
|
[:closed,:half_open,:open].each do |status|
|
87
89
|
data[:status][:general] = status if worst_status.include? status
|
88
90
|
end
|
89
|
-
|
91
|
+
if save != data[:status][:general] then
|
92
|
+
raise Sc4ry::Exceptions:CircuitBreaked if data[:status][:general] == :open and data[:raise_on_opening]
|
93
|
+
Sc4ry::Helpers.notify circuit: options[:circuit], config: data
|
94
|
+
end
|
90
95
|
@@circuits_store.put key: options[:circuit], value: data
|
91
96
|
end
|
92
97
|
end
|
data/lib/sc4ry/dependencies.rb
CHANGED
data/lib/sc4ry/run_controller.rb
CHANGED
@@ -43,7 +43,12 @@ module Sc4ry
|
|
43
43
|
elsif @circuit[:exceptions].include? e.class
|
44
44
|
@failure = true
|
45
45
|
else
|
46
|
-
|
46
|
+
if @circuit[:forward_unknown_exceptions] then
|
47
|
+
raise @last_exception.class, "Sc4ry forward: #{@last_exception.message}"
|
48
|
+
else
|
49
|
+
Sc4ry::Loggers.warning "skipped : #{@last_exception}"
|
50
|
+
end
|
51
|
+
|
47
52
|
end
|
48
53
|
end
|
49
54
|
@end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
data/lib/sc4ry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sc4ry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain GEORGES
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Sc4ry provide the design pattern Circuit breaker for your application.
|
14
14
|
email:
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- lib/sc4ry/backends/redis.rb
|
34
34
|
- lib/sc4ry/circuits.rb
|
35
35
|
- lib/sc4ry/dependencies.rb
|
36
|
+
- lib/sc4ry/exceptions.rb
|
36
37
|
- lib/sc4ry/exporters/init.rb
|
37
38
|
- lib/sc4ry/helpers.rb
|
38
39
|
- lib/sc4ry/logger.rb
|