ileitch / rapns

MOVED TO https://github.com/rpush/rpush
MIT License
289 stars 92 forks source link

Previous worker not sending notifications for new Apns Apps #141

Open saulm opened 11 years ago

saulm commented 11 years ago

Hi @ileitch, first of all thanks for the great work on the rapns gem,

I'm having a small issue and wanted to ask you about it:

When my rapns worker is running and I create a new Apns App, notifications are not send for this new app unless I restart the worker. Is it by design? have you run into this problem before? how have you addressed it?

I'm leaving you a small log sample from my app running on heroku. You can see there that I have to restart the worker so the notifications for the new app are sent.

Thanks in advance,

SM

2013-07-12T19:08:22.580927+00:00 app[rapns.1]: [2013-07-12 19:08:22] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:08:35.206160+00:00 app[rapns.1]: [2013-07-12 19:08:35] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:08:40.995541+00:00 app[rapns.1]: [2013-07-12 19:08:40] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:09:22.911372+00:00 app[rapns.1]: [2013-07-12 19:09:22] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:09:32.415993+00:00 app[web.1]: Started PUT "/apns_app/51c86bd9446ad7e40c000001_51e0544ada3604a205000013.json" for 54.242.138.86 at 2013-07-12 19:09:32 +0000
2013-07-12T19:09:32.640924+00:00 heroku[router]: at=info method=PUT path=/apns_app/51c86bd9446ad7e40c000001_51e0544ada3604a205000013.json host=kumakore-pn-testing.herokuapp.com fwd="54.242.138.86" dyno=web.1 connect=1ms service=229ms status=404 bytes=4
2013-07-12T19:09:32.671748+00:00 app[web.1]: Started POST "/apns_app.json" for 54.242.138.86 at 2013-07-12 19:09:32 +0000
2013-07-12T19:09:32.893886+00:00 heroku[router]: at=info method=POST path=/apns_app.json host=kumakore-pn-testing.herokuapp.com fwd="54.242.138.86" dyno=web.1 connect=3ms service=233ms status=201 bytes=8979
2013-07-12T19:09:35.788412+00:00 app[rapns.1]: [2013-07-12 19:09:35] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:09:41.444738+00:00 app[rapns.1]: [2013-07-12 19:09:41] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:10:23.125716+00:00 app[rapns.1]: [2013-07-12 19:10:23] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:10:36.255724+00:00 app[rapns.1]: [2013-07-12 19:10:36] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:10:41.758498+00:00 app[rapns.1]: [2013-07-12 19:10:41] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:11:24.106996+00:00 app[rapns.1]: [2013-07-12 19:11:24] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:11:36.898421+00:00 app[rapns.1]: [2013-07-12 19:11:36] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:11:41.989951+00:00 app[rapns.1]: [2013-07-12 19:11:41] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:12:24.488506+00:00 app[rapns.1]: [2013-07-12 19:12:24] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:12:37.756176+00:00 app[rapns.1]: [2013-07-12 19:12:37] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:12:42.225265+00:00 app[rapns.1]: [2013-07-12 19:12:42] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:13:24.985560+00:00 app[rapns.1]: [2013-07-12 19:13:24] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:13:38.290682+00:00 app[rapns.1]: [2013-07-12 19:13:38] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:13:42.562019+00:00 app[rapns.1]: [2013-07-12 19:13:42] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:14:25.327800+00:00 app[rapns.1]: [2013-07-12 19:14:25] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:14:38.752618+00:00 app[rapns.1]: [2013-07-12 19:14:38] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:14:41.881781+00:00 app[web.1]: Started POST "/apns_notification.json" for 54.242.138.86 at 2013-07-12 19:14:41 +0000
2013-07-12T19:14:41.927946+00:00 heroku[router]: at=info method=POST path=/apns_notification.json host=kumakore-pn-testing.herokuapp.com fwd="54.242.138.86" dyno=web.1 connect=1ms service=50ms status=200 bytes=46
2013-07-12T19:14:43.237299+00:00 app[rapns.1]: [2013-07-12 19:14:43] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:15:25.613810+00:00 app[rapns.1]: [2013-07-12 19:15:25] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:15:39.036144+00:00 app[rapns.1]: [2013-07-12 19:15:39] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:15:43.478576+00:00 app[rapns.1]: [2013-07-12 19:15:43] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:16:25.958095+00:00 app[rapns.1]: [2013-07-12 19:16:25] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:16:39.346176+00:00 app[rapns.1]: [2013-07-12 19:16:39] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:16:44.364415+00:00 app[rapns.1]: [2013-07-12 19:16:44] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:16:54.204799+00:00 heroku[api]: Scale to rapns=0, web=1 by saul@yacfirm.com
2013-07-12T19:16:54.404231+00:00 heroku[rapns.1]: State changed from up to down
2013-07-12T19:17:24.282347+00:00 heroku[api]: Scale to rapns=1, web=1 by saul@yacfirm.com
2013-07-12T19:17:26.571824+00:00 app[rapns.1]: [2013-07-12 19:17:26] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:17:28.116026+00:00 heroku[rapns.1]: Starting process with command `bundle exec rapns testing`
2013-07-12T19:17:35.481290+00:00 app[rapns.1]: [2013-07-12 19:17:35] [519180ae1b883f8dce000003_51a806e5f3d4bbf25f000003] Started, 1 handler.
2013-07-12T19:17:35.481727+00:00 app[rapns.1]: [2013-07-12 19:17:35] [519806eb092df3d9f3000002_51a5b3e6995cfb7ba7000001] Started, 1 handler.
2013-07-12T19:17:35.481999+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51ca7fcfdecea61e34000001_51cd2d4ac5ca585235000001] Started, 1 handler.
2013-07-12T19:17:35.482384+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Started, 1 handler.
2013-07-12T19:17:35.514815+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Started, 1 handler.
2013-07-12T19:17:35.515314+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51c86bd9446ad7e40c000001_51c936bf51d3fd637c000001] Started, 1 handler.
2013-07-12T19:17:35.515700+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Started, 1 handler.
2013-07-12T19:17:35.518169+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51c86bd9446ad7e40c000001_51e0544ada3604a205000013] Started, 1 handler.
2013-07-12T19:17:35.756274+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51c86bd9446ad7e40c000001_51e0544ada3604a205000013] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:17:35.768638+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:17:35.774624+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:17:35.776117+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51d7a9b24a85acb942000001_51d7a9c54a85ac1546000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:17:35.798481+00:00 app[rapns.1]: [2013-07-12 19:17:35] [51c86bd9446ad7e40c000001_51e0544ada3604a205000013] Connected to gateway.sandbox.push.apple.com:2195
2013-07-12T19:17:35.902123+00:00 heroku[router]: at=info method=GET path=/docs host=kumakore-pn-testing.herokuapp.com fwd="184.73.237.85" dyno=web.1 connect=2ms service=8ms status=200 bytes=1651
2013-07-12T19:17:36.095277+00:00 app[rapns.1]: [2013-07-12 19:17:36] [51c86bd9446ad7e40c000001_51e0544ada3604a205000013] 291 sent to 5ab99ddde083b12166b6563ef126f9e6ac731cf30f934a36184b4172481de23c
2013-07-12T19:17:41.056852+00:00 app[rapns.1]: [2013-07-12 19:17:41] [51d20c2f92157af33d000001_51d20c4492157aad5c000001] Connected to feedback.sandbox.push.apple.com:2196
2013-07-12T19:17:45.015249+00:00 app[rapns.1]: [2013-07-12 19:17:45] [51c86bd9446ad7e40c000001_51df2a02b7606deb9e000003] Connected to feedback.sandbox.push.apple.com:2196
ileitch commented 11 years ago

Yep, this is by design. See https://github.com/ileitch/rapns/wiki/Hot-App-Updates

I am tempted to change this behavior though and have the new apps auto-loaded.

saulm commented 11 years ago

oh, Ok, Thanks for the response

saulm commented 11 years ago

If someone stumbles accross this, Heroku doesn't support signals

ileitch commented 11 years ago

Reopening this as a reminder to myself to work on improving this case.

kushyar commented 11 years ago

So is there anyway to remedy this "issue" on Heroku given the lack of support for signals?

Thanks again for this great gem!

saulm commented 11 years ago

@y2kRules

Add the heroku-api gem

And issue a heroku.post_ps_restart(ENV["HEROKU_APP_NAME"], 'ps' => 'rapns.1') whenever you want to restart the worker