Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing push notifications for all but first device when sending through Delayed::Job #67

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
6 changes: 6 additions & 0 deletions lib/apn_on_rails/app/models/apn/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def self.send_notifications_for_cert(the_cert, app_id)
APN::Device.find_each(:conditions => conditions) do |dev|
dev.unsent_notifications.each do |noty|
conn.write(noty.message_for_sending)

# This seems to fix the bug where multiple notifications get
# missed by Apple when sending Push notifications as a worker
# task through Delayed::Job
sleep 0.00000001

noty.sent_at = Time.now
noty.save
end
Expand Down