Method: Rpush::Daemon::Delivery#mark_retryable

Defined in:
lib/rpush/daemon/delivery.rb

#mark_retryable(notification, deliver_after, error = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/rpush/daemon/delivery.rb', line 7

def mark_retryable(notification, deliver_after, error = nil)
  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
    if error
      log_warn("Will retry notification #{notification.id} after #{deliver_after.strftime('%Y-%m-%d %H:%M:%S')} due to error (#{error.class.name}, #{error.message})")
    end
    @batch.mark_retryable(notification, deliver_after)
  end
end