Module: Rapns::Daemon

Extended by:
DatabaseReconnectable
Defined in:
lib/rapns/daemon.rb,
lib/rapns/daemon/feeder.rb,
lib/rapns/daemon/logger.rb,
lib/rapns/daemon/app_runner.rb,
lib/rapns/daemon/connection.rb,
lib/rapns/daemon/delivery_queue.rb,
lib/rapns/daemon/delivery_handler.rb,
lib/rapns/daemon/delivery_queue_18.rb,
lib/rapns/daemon/delivery_queue_19.rb,
lib/rapns/daemon/feedback_receiver.rb,
lib/rapns/daemon/interruptible_sleep.rb,
lib/rapns/daemon/delivery_handler_pool.rb,
lib/rapns/daemon/database_reconnectable.rb

Defined Under Namespace

Modules: DatabaseReconnectable, InterruptibleSleep Classes: AppRunner, Connection, ConnectionError, DeliveryHandler, DeliveryHandlerPool, DeliveryQueue, DeliveryQueue18, DeliveryQueue19, FeedbackReceiver, Feeder, Logger

Constant Summary

Constants included from DatabaseReconnectable

DatabaseReconnectable::ADAPTER_ERRORS

Class Attribute Summary collapse

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

Class Attribute Details

.configObject

Returns the value of attribute config.



24
25
26
# File 'lib/rapns/daemon.rb', line 24

def config
  @config
end

.loggerObject

Returns the value of attribute logger.



24
25
26
# File 'lib/rapns/daemon.rb', line 24

def logger
  @logger
end

Class Method Details

.start(config) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rapns/daemon.rb', line 27

def self.start(config)
  self.config = config
  self.logger = Logger.new(:foreground => config.foreground, :airbrake_notify => config.airbrake_notify)
  setup_signal_hooks

  unless config.foreground
    daemonize
    reconnect_database
  end

  write_pid_file
  ensure_upgraded
  AppRunner.sync
  Feeder.start(config.push_poll)
end