Module: Rapns::Daemon

Defined in:
lib/rapns/daemon.rb,
lib/rapns/daemon/batch.rb,
lib/rapns/daemon/feeder.rb,
lib/rapns/daemon/delivery.rb,
lib/rapns/daemon/app_runner.rb,
lib/rapns/daemon/reflectable.rb,
lib/rapns/daemon/gcm/delivery.rb,
lib/rapns/daemon/apns/delivery.rb,
lib/rapns/daemon/gcm/app_runner.rb,
lib/rapns/daemon/apns/app_runner.rb,
lib/rapns/daemon/apns/connection.rb,
lib/rapns/daemon/delivery_handler.rb,
lib/rapns/daemon/interruptible_sleep.rb,
lib/rapns/daemon/store/active_record.rb,
lib/rapns/daemon/gcm/delivery_handler.rb,
lib/rapns/daemon/apns/delivery_handler.rb,
lib/rapns/daemon/apns/feedback_receiver.rb,
lib/rapns/daemon/delivery_handler_collection.rb,
lib/rapns/daemon/store/active_record/reconnectable.rb

Defined Under Namespace

Modules: Apns, Gcm, Reflectable, Store Classes: AppRunner, Batch, Delivery, DeliveryHandler, DeliveryHandlerCollection, Feeder, InterruptibleSleep

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.storeObject

Returns the value of attribute store.



33
34
35
# File 'lib/rapns/daemon.rb', line 33

def store
  @store
end

Class Method Details

.initialize_storeObject



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rapns/daemon.rb', line 60

def self.initialize_store
  return if store
  begin
    require "rapns/daemon/store/#{Rapns.config.store}"
    klass = "Rapns::Daemon::Store::#{Rapns.config.store.to_s.camelcase}".constantize
    self.store = klass.new
  rescue StandardError, LoadError => e
    Rapns.logger.error("Failed to load '#{Rapns.config.store}' storage backend.")
    Rapns.logger.error(e)
  end
end

.shutdown(quiet = false) ⇒ Object



53
54
55
56
57
58
# File 'lib/rapns/daemon.rb', line 53

def self.shutdown(quiet = false)
  puts "\nShutting down..." unless quiet
  Feeder.stop
  AppRunner.stop
  delete_pid_file
end

.startObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rapns/daemon.rb', line 36

def self.start
  setup_signal_traps if trap_signals?

  initialize_store
  return unless store

  if daemonize?
    daemonize
    store.after_daemonize
  end

  write_pid_file
  Upgraded.check(:exit => true)
  AppRunner.sync
  Feeder.start
end