Class: Rpush::Daemon::Apns::Delivery

Inherits:
Delivery
  • Object
show all
Defined in:
lib/rpush/daemon/apns/delivery.rb

Instance Method Summary collapse

Methods inherited from Delivery

#mark_batch_delivered, #mark_batch_failed, #mark_batch_retryable, #mark_delivered, #mark_failed, #mark_retryable, #mark_retryable_exponential

Methods included from Loggable

#log_debug, #log_error, #log_info, #log_warn

Methods included from Reflectable

#reflect

Constructor Details

#initialize(app, connection, batch) ⇒ Delivery

Returns a new instance of Delivery.



5
6
7
8
9
# File 'lib/rpush/daemon/apns/delivery.rb', line 5

def initialize(app, connection, batch)
  @app = app
  @connection = connection
  @batch = batch
end

Instance Method Details

#performObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rpush/daemon/apns/delivery.rb', line 11

def perform
  @connection.write(batch_to_binary)
  mark_batch_delivered
  describe_deliveries
rescue Rpush::Daemon::TcpConnectionError => error
  mark_batch_retryable(Time.now + 10.seconds, error)
  raise
rescue StandardError => error
  mark_batch_failed(error)
  raise
ensure
  @batch.all_processed
end