Class: Rpush::Daemon::Delivery

Inherits:
Object
  • Object
show all
Includes:
Loggable, Reflectable
Defined in:
lib/rpush/daemon/delivery.rb

Instance Method Summary collapse

Methods included from Loggable

#log_error, #log_info, #log_warn

Methods included from Reflectable

#reflect

Instance Method Details

#mark_deliveredObject



19
20
21
# File 'lib/rpush/daemon/delivery.rb', line 19

def mark_delivered
  @batch.mark_delivered(@notification)
end

#mark_failed(code, description) ⇒ Object



23
24
25
# File 'lib/rpush/daemon/delivery.rb', line 23

def mark_failed(code, description)
  @batch.mark_failed(@notification, code, description)
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