Module: Idcf::Cli::Lib::Include::RecurringCalling

Included in:
Controller::Base, Service::Base
Defined in:
lib/idcf/cli/lib/include/recurring_calling.rb

Overview

Recurring calling

Instance Method Summary collapse

Instance Method Details

#recurring_calling(call_name, args, max = 20, sleep_offset = 2) ⇒ Object

recurring calling



15
16
17
18
19
20
21
22
# File 'lib/idcf/cli/lib/include/recurring_calling.rb', line 15

def recurring_calling(call_name, args, max = 20, sleep_offset = 2)
  (1..max).each do |n|
    res = __send__(call_name.to_sym, *args)
    return res if yield(res)
    sleep sleep_offset * n
  end
  raise Idcf::Cli::Error::CliError, 'Authentication time out
'
end