Class: Rpush::Daemon::Delivery
Instance Method Summary
collapse
Methods included from Loggable
#log_error, #log_info, #log_warn
#reflect
Instance Method Details
#mark_batch_delivered ⇒ Object
23
24
25
|
# File 'lib/rpush/daemon/delivery.rb', line 23
def mark_batch_delivered
@batch.mark_all_delivered
end
|
#mark_batch_failed(error) ⇒ Object
32
33
34
35
|
# File 'lib/rpush/daemon/delivery.rb', line 32
def mark_batch_failed(error)
code = error.respond_to?(:code) ? error.code : nil
@batch.mark_all_failed(code, error.to_s)
end
|
#mark_delivered ⇒ Object
19
20
21
|
# File 'lib/rpush/daemon/delivery.rb', line 19
def mark_delivered
@batch.mark_delivered(@notification)
end
|
#mark_failed(error) ⇒ Object
27
28
29
30
|
# File 'lib/rpush/daemon/delivery.rb', line 27
def mark_failed(error)
code = error.respond_to?(:code) ? error.code : nil
@batch.mark_failed(@notification, code, error.to_s)
end
|
#mark_retryable(notification, deliver_after) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/rpush/daemon/delivery.rb', line 7
def mark_retryable(notification, deliver_after)
if notification.fail_after && notification.fail_after < Time.now
@batch.mark_failed(notification, nil, "Notification failed to be delivered before #{notification.fail_after.strftime("%Y-%m-%d %H:%M:%S")}.")
else
@batch.mark_retryable(notification, deliver_after)
end
end
|
#mark_retryable_exponential(notification) ⇒ Object
15
16
17
|
# File 'lib/rpush/daemon/delivery.rb', line 15
def mark_retryable_exponential(notification)
mark_retryable(notification, Time.now + 2**(notification.retries + 1))
end
|