apn_sender icon indicating copy to clipboard operation
apn_sender copied to clipboard

This lib with Resque creates new connection to APNS each time

Open yuriihabrusiev opened this issue 11 years ago • 11 comments

You wrote in README

sends them along to Apple over a single, persistent socket

but with Resque it creates new connection and new client object each time

D, [2013-11-21T13:05:55.474087 #17156] DEBUG -- : 2013-11-21 13:05:55 +0200: Connecting to gateway.push.apple.com:2195...
D, [2013-11-21T13:05:55.474160 #17156] DEBUG -- : 2013-11-21 13:05:55 +0200: #<APN::Client:0x007f3d00d888a0>
D, [2013-11-21T13:05:56.206347 #17156] DEBUG -- : 2013-11-21 13:05:56 +0200: Message sent.

...

D, [2013-11-21T13:06:01.213870 #17168] DEBUG -- : 2013-11-21 13:06:01 +0200: Connecting to gateway.push.apple.com:2195...
D, [2013-11-21T13:06:01.214269 #17168] DEBUG -- : 2013-11-21 13:06:01 +0200: #<APN::Client:0x007f3d00dba530>
D, [2013-11-21T13:06:01.807808 #17168] DEBUG -- : 2013-11-21 13:06:01 +0200: Message sent.

Maybe I'm doing something wrong, but can you explain this behavior?

yuriihabrusiev avatar Nov 21 '13 11:11 yuriihabrusiev

@k3mm0tar that was a regression on version 2.0.0 .. You can either use version 1.0.x that doesnt have that bug or wait for a patch on 2... Also PR are more than welcome, so fell free to submit a patch with the fix.

thanks

arthurnn avatar Nov 28 '13 21:11 arthurnn

It seems this issue is not present in 2.0.1 anymore. Using Resque with a single persistent connection.

toto avatar Jan 10 '14 11:01 toto

@toto I'm having this issue on 2.0.1. I suspect that that's the reason why apple is shutting down our push.

gamafranco avatar Jan 24 '14 22:01 gamafranco

@arthurnn we can take care of that. Do you have an idea where the issue can be? Is there any spec failing?

Please show the way and we'll be glad to take it from there.

Thanks.

gamafranco avatar Jan 24 '14 22:01 gamafranco

Due to Resque forking model, it creates new socket for every fork. I can't understand why, because my Mongo connection remain the same. May be something wrong with Resque. I try to create connection before Resque start and use it in my push job and got Broken pipe (Errno::EPIPE)

yuriihabrusiev avatar Jan 25 '14 08:01 yuriihabrusiev

@toto I tried, every time got new connection.

yuriihabrusiev avatar Jan 25 '14 08:01 yuriihabrusiev

@k3mm0tar True, I think I had a problem in my test setup. Now it does the same thing here as well.

toto avatar Jan 27 '14 09:01 toto

This is also happening with Sidekiq.

gamafranco avatar Jan 27 '14 14:01 gamafranco

Is it still the case today?

thbar avatar Apr 30 '14 08:04 thbar

+1

caseysackett avatar Aug 07 '14 23:08 caseysackett

To be honest I have a stable environment now, using one of my forks, and I don't want to conduct tests on unstable releases. But would be nice to have a new version of the gem officially released (the last one is from 2011).

If this happens, I can test it and check if this is still open.

gamafranco avatar Aug 08 '14 10:08 gamafranco