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

Instance Method Summary collapse

Instance Attribute Details

#configObject (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

#flaky?(test) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ci/queue/common.rb', line 18

def flaky?(test)
  @config.flaky?(test)
end

#release!Object



14
15
16
# File 'lib/ci/queue/common.rb', line 14

def release!
  # noop
end

#report_failure!Object



22
23
24
# File 'lib/ci/queue/common.rb', line 22

def report_failure!
  config.circuit_breakers.each(&:report_failure!)
end

#report_success!Object



26
27
28
# File 'lib/ci/queue/common.rb', line 26

def report_success!
  config.circuit_breakers.each(&:report_success!)
end

#rescue_connection_errors(handler = ->(err) { nil }) ⇒ Object



30
31
32
33
34
# File 'lib/ci/queue/common.rb', line 30

def rescue_connection_errors(handler = ->(err) { nil })
  yield
rescue *self::class::CONNECTION_ERRORS => err
  handler.call(err)
end

#retrying?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/ci/queue/common.rb', line 10

def retrying?
  false
end