Module: CI::Queue::Common
- Included in:
- Redis::Base, Static
- Defined in:
- lib/ci/queue/common.rb
Constant Summary collapse
- CONNECTION_ERRORS =
to override in classes including this module
[].freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #distributed? ⇒ Boolean
- #flaky?(test) ⇒ Boolean
- #release! ⇒ Object
- #report_failure! ⇒ Object
- #report_success! ⇒ Object
- #rescue_connection_errors(handler = ->(err) { nil }) ⇒ Object
- #retrying? ⇒ Boolean
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/ci/queue/common.rb', line 5 def config @config end |
Instance Method Details
#distributed? ⇒ Boolean
10 11 12 |
# File 'lib/ci/queue/common.rb', line 10 def distributed? raise NotImplementedError end |
#flaky?(test) ⇒ Boolean
22 23 24 |
# File 'lib/ci/queue/common.rb', line 22 def flaky?(test) @config.flaky?(test) end |
#release! ⇒ Object
18 19 20 |
# File 'lib/ci/queue/common.rb', line 18 def release! # noop end |
#report_failure! ⇒ Object
26 27 28 |
# File 'lib/ci/queue/common.rb', line 26 def report_failure! config.circuit_breakers.each(&:report_failure!) end |
#report_success! ⇒ Object
30 31 32 |
# File 'lib/ci/queue/common.rb', line 30 def report_success! config.circuit_breakers.each(&:report_success!) end |
#rescue_connection_errors(handler = ->(err) { nil }) ⇒ Object
34 35 36 37 38 |
# File 'lib/ci/queue/common.rb', line 34 def rescue_connection_errors(handler = ->(err) { nil }) yield rescue *self::class::CONNECTION_ERRORS => err handler.call(err) end |
#retrying? ⇒ Boolean
14 15 16 |
# File 'lib/ci/queue/common.rb', line 14 def false end |