You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have records in apn_notifications table with NIL 'sent_at'.
But after running command
rake apn:notifications:deliver
Some still remains with sent_at as NIL.
Is there any issue with gem or my following code.
def perform
tracker = PushTracker.find(@tracker_id)
begin
notifications = APN::Notification.all(:conditions => 'sent_at IS NULL')
if(!notifications.empty?)
tracker.start_sending = Time.now if tracker.start_sending.nil?
tracker.end_sending = Time.now
tracker.sending = true
tracker.save!
#send the notifications
system "rake apn:notifications:deliver"
#set up another delayed job in the future in case they all didn't go through
Delayed::Job.enqueue(PushSender.new(@tracker_id),0, 5.minutes.from_now)
else
tracker.clean! if defined?(tracker) && !tracker.nil?
end
rescue => e
HoptoadNotifier.notify(
:error_class => "Push Sender",
:error_message => "Push Sender Error: #{e.message}",
:request => {:tracker => tracker, :exception => e}
)
tracker.clean! if defined?(tracker) && !tracker.nil?
end
end
Note: I am running above piece of code as heroku delayed job.
Any help would be appreciated.
Thnaks.
The text was updated successfully, but these errors were encountered:
I have records in apn_notifications table with NIL 'sent_at'.
But after running command
rake apn:notifications:deliver
Some still remains with sent_at as NIL.
Is there any issue with gem or my following code.
def perform
tracker = PushTracker.find(@tracker_id)
begin
notifications = APN::Notification.all(:conditions => 'sent_at IS NULL')
if(!notifications.empty?)
tracker.start_sending = Time.now if tracker.start_sending.nil?
tracker.end_sending = Time.now
tracker.sending = true
tracker.save!
#send the notifications
system "rake apn:notifications:deliver"
#set up another delayed job in the future in case they all didn't go through
Delayed::Job.enqueue(PushSender.new(@tracker_id),0, 5.minutes.from_now)
else
tracker.clean! if defined?(tracker) && !tracker.nil?
end
rescue => e
HoptoadNotifier.notify(
:error_class => "Push Sender",
:error_message => "Push Sender Error: #{e.message}",
:request => {:tracker => tracker, :exception => e}
)
tracker.clean! if defined?(tracker) && !tracker.nil?
end
end
Note: I am running above piece of code as heroku delayed job.
Any help would be appreciated.
Thnaks.
The text was updated successfully, but these errors were encountered: