Class: Push::Daemon::Feeder

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

Class Method Summary collapse

Methods included from DatabaseReconnectable

adaptor_errors, 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/push/daemon/feeder.rb', line 7

def self.name
  "Feeder"
end

.start(config) ⇒ Object



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

def self.start(config)
  reconnect_database unless config.foreground

  loop do
    break if @stop
    enqueue_notifications
    interruptible_sleep config.push_poll
  end
end

.stopObject



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

def self.stop
  @stop = true
  interrupt_sleep
end