Method: Rpush::Daemon::InterruptibleSleep#sleep

Defined in:
lib/rpush/daemon/interruptible_sleep.rb

#sleep(duration) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rpush/daemon/interruptible_sleep.rb', line 4

def sleep(duration)
  @thread = Thread.new { Kernel.sleep duration }
  Thread.pass

  begin
    @thread.join
  rescue StandardError # rubocop:disable Lint/HandleExceptions
  ensure
    @thread = nil
  end
end