Class: Rapns::Daemon::Feeder

Inherits:
Object
  • Object
show all
Extended by:
DatabaseReconnectable, InterruptibleSleep
Defined in:
lib/rapns/daemon/feeder.rb

Constant Summary

Constants included from DatabaseReconnectable

DatabaseReconnectable::ADAPTER_ERRORS

Class Method Summary collapse

Methods included from DatabaseReconnectable

check_database_is_connected, database_connection_lost, reconnect_database, sleep_to_avoid_thrashing, with_database_reconnect_and_retry

Methods included from InterruptibleSleep

interrupt_sleep, interruptible_sleep

Class Method Details

.nameObject



7
8
9
# File 'lib/rapns/daemon/feeder.rb', line 7

def self.name
  "Feeder"
end

.start(foreground) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rapns/daemon/feeder.rb', line 11

def self.start(foreground)
  reconnect_database unless foreground

  loop do
    break if @stop
    enqueue_notifications
    interruptible_sleep Rapns::Daemon.configuration.push.poll
  end
end

.stopObject



21
22
23
24
# File 'lib/rapns/daemon/feeder.rb', line 21

def self.stop
  @stop = true
  interrupt_sleep
end