Class: Orchestration::ServiceCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestration/service_check.rb

Constant Summary collapse

ATTEMPT_LIMIT =
10
RETRY_INTERVAL =

seconds

3

Instance Method Summary collapse

Constructor Details

#initialize(service, terminal, options = {}) ⇒ ServiceCheck

Returns a new instance of ServiceCheck.



8
9
10
11
12
13
14
15
16
# File 'lib/orchestration/service_check.rb', line 8

def initialize(service, terminal, options = {})
  @service = service
  @service_name = service_name(service)
  @terminal = terminal
  @attempt_limit = options.fetch(:attempt_limit, ATTEMPT_LIMIT)
  @retry_interval = options.fetch(:retry_interval, RETRY_INTERVAL)
  @attempts = 0
  @failure_callback = options.fetch(:failure_callback, nil)
end

Instance Method Details

#runObject



18
19
20
21
22
23
# File 'lib/orchestration/service_check.rb', line 18

def run
  echo_start
  success = attempt_connection
  echo_ready if success
  success
end