Module: OpenNebula::WaitExtPolling
- Defined in:
- lib/opennebula/wait_ext.rb
Instance Method Summary collapse
Instance Method Details
#wait2(sstr1, sstr2, timeout = 60, cycles = -1)) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/opennebula/wait_ext.rb', line 95 def wait2(sstr1, sstr2, timeout = 60, cycles = -1) wfun = OpenNebula::WaitExt::WAIT[self.class] stime = 5 recvs = 0 cycles = timeout / stime in_state = false loop do rco = info return false if OpenNebula.is_error?(rco) in_state = wfun[:in_state].call(self, sstr1, sstr2) recvs += 1 break if in_state || recvs >= cycles sleep stime end in_state end |