lib/powertrack/streaming/stream.rb
def wait_til_defers_finish_and_stop(timeout)
      # wait for defers to terminate but no more than timeout...
      start = Time.now
      defers_waiter = EM.add_periodic_timer(0.2) do
        logger.info "Waiting for defers..."
        if EM.defers_finished? || (Time.now - start) > timeout
          defers_waiter.cancel
        end
      end
    ensure
      logger.info "Stopping the reactor..."
      EM.stop
    end
# Waits for all the deferrable threads to complete, then stops the reactor.
Waits for all the deferrable threads to complete, then stops the reactor.
Waits for all the deferrable threads to complete then stops the reactor .
def wait_til_defers_finish_and_stop(timeout)
      start = Time.now
      defers_waiter = EM.add_periodic_timer(0.2) do
        logger.info "Waiting for defers..."
        if EM.defers_finished? || (Time.now - start) > timeout
          defers_waiter.cancel
        end
      end
    ensure
      logger.info "Stopping the reactor..."
      EM.stop
    end
def wait_til_defers_finish_and_stop ( timeout ) start = Time . now defers_waiter = EM . add_periodic_timer ( 0.2 ) do logger . info "Waiting for defers..." if EM . defers_finished? || ( Time . now - start ) > timeout defers_waiter . cancel end end ensure logger . info "Stopping the reactor..." EM . stop end
Waits for all the deferrable threads to complete, then stops the reactor.
Waits for all the deferrable threads to complete then stops the reactor .
# wait for defers to terminate but no more than timeout...
timeout