module Elasticsearch::Drain::Util
Public Instance Methods
to_thor(name, message, color)
click to toggle source
# File lib/elasticsearch/drain/util.rb, line 19 def to_thor(name, message, color) @thor_shell_client ||= Thor::Shell::Basic.new @thor_shell_client.say_status(name, message, color) end
wait_until(expected, max_attempts = 5, delay = 60, &block)
click to toggle source
# File lib/elasticsearch/drain/util.rb, line 6 def wait_until(expected, max_attempts = 5, delay = 60, &block) 1.upto(max_attempts) do |i| result = block.call if result == expected return else to_thor('Waiting', "Waiting #{delay} seconds for #{i}/#{max_attempts} attempts", :yellow) sleep delay end end fail Errors::WaiterExpired end