faulty 0.8.7 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3148a3eb0ec2e45213ddb40bef524a3b0fa83e83b467101982d7ced65cbac71a
4
- data.tar.gz: fd9584532fde4f3409720ca1884f825fc4d6eabb4ebe133c80e969bc0131ab9f
3
+ metadata.gz: 3c98e42a6c19d8832dc0267abba5498f0203922bd98cb3bb1b9c28643c9a9f3f
4
+ data.tar.gz: 7b68f35acfa54c10ec411d26eb45319eb47bf6d688d447adaead117f1ec098ab
5
5
  SHA512:
6
- metadata.gz: 330476d53d625bb22dbd2f5855dd40f4f4849135b1407df72e9ff3849504341f9e67cf6ce5bb0606bd62100a9d11dda2f7d7754be081b40b8c81784d1e25265d
7
- data.tar.gz: 9f8023dbd90ea1d9fb55a1a5c7a9c96a9344b0db43e0735113545406734e0f02ea14bcc1550b8d2b335e1b59bd63591812ed2426f66f097789185531f6d2db51
6
+ metadata.gz: 2677b6450704cbabd6b9c9e3c5d68bad7b762810f27f0b0a9171bca825051c9668aff54aadb58b73884a266f5c0fdfaa46f57d56bc0a6d93824bb1d02c4c08fd
7
+ data.tar.gz: ef98388e2d161b8995310de758b11ddc960a2b0b4c05605ba9cf7e30334c36bb8590578259c0e0158516254fb56d9bc1bb5cb2f42cea88c8224c176301535898
data/CHANGELOG.md CHANGED
@@ -9,6 +9,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
  [Unreleased]
10
10
  -------------------
11
11
 
12
+ [0.9.0] - 2022-08-18
13
+ ---------------------
14
+
15
+ ### Added
16
+
17
+ * Setup codecov code coverage #57 justinhoward
18
+
19
+ ### Fixed
20
+
21
+ * Fix a regression where ConnectionPool was required for the redis storage #58 justinhoward
22
+
23
+ ### Changed
24
+
25
+ * Change current_time to a float #59 justinhoward
26
+
27
+ ### Removed
28
+
29
+ * Remove features deprecated in 0.8.5 #60 justinhoward
30
+
31
+ ### Breaking
32
+
33
+ * `Faulty.current_time` is now a float instead of an integer
34
+ * The 3 argument form of `Storage::Interface#entry` deprecated in 0.8.5 is now
35
+ removed.
36
+ * The `error_module` circuit option deprecated in 0.8.5 is now removed.
37
+
12
38
  [0.8.7] - 2022-08-11
13
39
  -------------------
14
40
 
@@ -263,11 +289,12 @@ of AutoWire.
263
289
 
264
290
  Initial public release
265
291
 
266
- [Unreleased]: https://github.com/ParentSquare/faulty/compare/v0.5.0...HEAD
292
+ [Unreleased]: https://github.com/ParentSquare/faulty/compare/v0.9.0...HEAD
293
+ [0.9.0]: https://github.com/ParentSquare/faulty/compare/v0.8.7...v0.9.0
294
+ [0.8.7]: https://github.com/ParentSquare/faulty/compare/v0.8.6...v0.8.7
267
295
  [0.8.6]: https://github.com/ParentSquare/faulty/compare/v0.8.5...v0.8.6
268
296
  [0.8.5]: https://github.com/ParentSquare/faulty/compare/v0.8.4...v0.8.5
269
- [0.8.4]: https://github.com/ParentSquare/faulty/compare/v0.8.3...v0.8.4
270
- [0.8.3]: https://github.com/ParentSquare/faulty/compare/v0.8.2...v0.8.3
297
+ [0.8.4]: https://github.com/ParentSquare/faulty/compare/v0.8.2...v0.8.4
271
298
  [0.8.2]: https://github.com/ParentSquare/faulty/compare/v0.8.1...v0.8.2
272
299
  [0.8.1]: https://github.com/ParentSquare/faulty/compare/v0.8.0...v0.8.1
273
300
  [0.8.0]: https://github.com/ParentSquare/faulty/compare/v0.7.2...v0.8.0
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/faulty.svg)](https://badge.fury.io/rb/faulty)
4
4
  [![CI](https://github.com/ParentSquare/faulty/workflows/CI/badge.svg)](https://github.com/ParentSquare/faulty/actions?query=workflow%3ACI+branch%3Amaster)
5
5
  [![Code Quality](https://app.codacy.com/project/badge/Grade/16bb1df1569a4ddba893a866673dac2a)](https://www.codacy.com/gh/ParentSquare/faulty/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ParentSquare/faulty&utm_campaign=Badge_Grade)
6
- [![Code Coverage](https://app.codacy.com/project/badge/Coverage/16bb1df1569a4ddba893a866673dac2a)](https://www.codacy.com/gh/ParentSquare/faulty/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ParentSquare/faulty&utm_campaign=Badge_Coverage)
6
+ [![Code Coverage](https://codecov.io/gh/ParentSquare/faulty/branch/master/graph/badge.svg?token=1NDT4FW1YJ)](https://codecov.io/gh/ParentSquare/faulty)
7
7
  [![Inline docs](http://inch-ci.org/github/ParentSquare/faulty.svg?branch=master)](http://inch-ci.org/github/ParentSquare/faulty)
8
8
 
9
9
  Fault-tolerance tools for ruby based on [circuit-breakers][martin fowler].
@@ -98,7 +98,6 @@ class Faulty
98
98
  :sample_threshold,
99
99
  :errors,
100
100
  :error_mapper,
101
- :error_module,
102
101
  :exclude,
103
102
  :cache,
104
103
  :notifier,
@@ -158,17 +157,6 @@ class Faulty
158
157
  unless cache_refreshes_after.nil?
159
158
  self.cache_refresh_jitter = 0.2 * cache_refreshes_after
160
159
  end
161
-
162
- deprecated_error_module
163
- end
164
-
165
- private
166
-
167
- def deprecated_error_module
168
- return unless error_module
169
-
170
- Deprecation.method(self.class, :error_module, note: 'See :error_mapper', sunset: '0.9.0')
171
- self.error_mapper = error_module
172
160
  end
173
161
  end
174
162
 
@@ -442,11 +430,7 @@ class Faulty
442
430
 
443
431
  # @return [Boolean] True if the circuit transitioned to closed
444
432
  def success!(status)
445
- if deprecated_entry?
446
- storage.entry(self, Faulty.current_time, true, nil)
447
- else
448
- storage.entry(self, Faulty.current_time, true)
449
- end
433
+ storage.entry(self, Faulty.current_time, true, nil)
450
434
  closed = close! if status.half_open?
451
435
 
452
436
  options.notifier.notify(:circuit_success, circuit: self)
@@ -455,11 +439,7 @@ class Faulty
455
439
 
456
440
  # @return [Boolean] True if the circuit transitioned to open
457
441
  def failure!(status, error)
458
- status = if deprecated_entry?
459
- storage.entry(self, Faulty.current_time, false, status)
460
- else
461
- deprecated_entry(status)
462
- end
442
+ status = storage.entry(self, Faulty.current_time, false, status)
463
443
  options.notifier.notify(:circuit_failure, circuit: self, status: status, error: error)
464
444
 
465
445
  if status.half_open?
@@ -471,23 +451,6 @@ class Faulty
471
451
  end
472
452
  end
473
453
 
474
- def deprecated_entry?
475
- return @deprecated_entry unless @deprecated_entry.nil?
476
-
477
- @deprecated_entry = storage.method(:entry).arity == 4
478
- end
479
-
480
- def deprecated_entry(status)
481
- Faulty::Deprecation.deprecate(
482
- 'Returning entries array from entry',
483
- note: 'see Storate::Interface#entry',
484
- sunset: '0.9'
485
- )
486
-
487
- entries = storage.entry(self, Faulty.current_time, false)
488
- Status.from_entries(entries, **status.to_h)
489
- end
490
-
491
454
  def skipped!
492
455
  options.notifier.notify(:circuit_skipped, circuit: self)
493
456
  end
@@ -232,7 +232,7 @@ class Faulty
232
232
  end
233
233
 
234
234
  state = futures[:state].value&.to_sym || :closed
235
- opened_at = futures[:opened_at].value ? futures[:opened_at].value.to_i : nil
235
+ opened_at = futures[:opened_at].value ? Float(futures[:opened_at].value) : nil
236
236
  opened_at = Faulty.current_time - options.circuit_ttl if state == :open && opened_at.nil?
237
237
 
238
238
  Faulty::Status.from_entries(
@@ -356,7 +356,7 @@ class Faulty
356
356
  #
357
357
  # @return [Integer] The current block number
358
358
  def current_list_block
359
- (Faulty.current_time.to_f / options.list_granularity).floor
359
+ (Faulty.current_time / options.list_granularity).floor
360
360
  end
361
361
 
362
362
  # Watch a Redis key and exec commands only if the key matches the expected
@@ -411,7 +411,7 @@ class Faulty
411
411
  def map_entries(raw_entries)
412
412
  raw_entries.map do |e|
413
413
  time, state = e.split(ENTRY_SEPARATOR)
414
- [time.to_i, state == '1']
414
+ [Float(time), state == '1']
415
415
  end
416
416
  end
417
417
 
@@ -449,7 +449,7 @@ class Faulty
449
449
  end
450
450
 
451
451
  def check_pool_options!
452
- if options.client.instance_of?(ConnectionPool)
452
+ if options.client.class.name == 'ConnectionPool'
453
453
  timeout = options.client.instance_variable_get(:@timeout)
454
454
  warn(<<~MSG) if timeout > 2
455
455
  Faulty recommends setting ConnectionPool timeouts <= 2 to prevent
@@ -3,6 +3,6 @@
3
3
  class Faulty
4
4
  # The current Faulty version
5
5
  def self.version
6
- Gem::Version.new('0.8.7')
6
+ Gem::Version.new('0.9.0')
7
7
  end
8
8
  end
data/lib/faulty.rb CHANGED
@@ -129,7 +129,7 @@ class Faulty
129
129
  #
130
130
  # @return [Time] The current time
131
131
  def current_time
132
- Time.now.to_i
132
+ Time.now.to_f
133
133
  end
134
134
 
135
135
  # Disable Faulty circuits
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faulty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-11 00:00:00.000000000 Z
11
+ date: 2022-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -150,7 +150,7 @@ licenses:
150
150
  metadata:
151
151
  rubygems_mfa_required: 'true'
152
152
  changelog_uri: https://github.com/ParentSquare/faulty/blob/master/CHANGELOG.md
153
- documentation_uri: https://www.rubydoc.info/gems/faulty/0.8.7
153
+ documentation_uri: https://www.rubydoc.info/gems/faulty/0.9.0
154
154
  post_install_message:
155
155
  rdoc_options: []
156
156
  require_paths: