-
Notifications
You must be signed in to change notification settings - Fork 120
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
Persistence not working properly #45
Comments
i'm getting the same error but without using |
I solve this by not testing in irb. Had it running in production now for On Mon, Dec 15, 2014 at 3:36 PM, Matias [email protected] wrote:
|
This does occur for me in production from background sidekiq workers. Subsequent retries are successful. |
First and foremost, what if any error message do you get? Where are your setting it to persist? What does your over all worker And then, does a call to your push worker look like? On Wed, Dec 24, 2014 at 10:22 AM, Adam St. John [email protected]
|
It's the same error as what @prockport has mentioned. It would seem that the backtrace:
Our push notification method is abstracted to a high level:
There is nothing abnormal about the procedure or the message we are sending. Telnetting into APNS manually works fine. Subsequent retries by the sidekiq worker also work so the problem seems intermittent. This is on jRuby 1.7.18. |
I have a separate worker class just for push. I open a persistent Basically, take the start_persistent out of the method call. I use On Wed, Dec 24, 2014 at 6:24 PM, Adam St. John [email protected]
|
@prockport, that makes sense and so I will most likely restructure our sidekiq worker. That said, I think the root of this problem might be the fact that |
I'm really with a lot of work at the moment but I want to completely redesign this gem, one of the things that bugs me a lot is this problem you are having. I don't understand why would you need to open a connection from one thread and keep it open for a very long time this code:
is the same as this:
And if you still need to open a persistent connection because one method opens the connection and another closes it, maybe you shouldn't do that, especially when you work in threads like sidekiq or resque workers |
@NicosKaralis, I took a stab at redesigning the gem based on feedback and pull requests from others. Please take a look here: It uses a new structure with a With a Gateway class, I think many of the threading issues have been addressed. We can open and close the apns connection for as long as needed. I also happen to disagree with keeping a persistent connection open forever. I also introduced a configuration pattern seen in many other gems in which you would setup everything in a rails initializer. I have also included a few changes to address iOS 8 issues. Usage is as follows:
We've been using this in production for gps and apns. Please check it out and let me know what you think. Amazon has not been tested. @prockport - If you want me to submit a pull for this big re-write, just let me know and I'll try to find some time to improve the specs, which are largely empty at this point. |
Excellent job @astjohn. It is exactly what I need to grab this gem as solution to our platform. Do you have intention to work in Amazon refactory? |
@maxintech, Not completely sure what you mean by Amazon refactory, but I did refactor all of the current providers. |
I'm sorry, I misread the last sentence "Amazon has not been tested.". Never mind... I will take a chance next week and I let you know if is working in Amazon too. |
@maxintech - sounds great. Let me know how it goes. |
Hey @astjohn, the lib works fine in all three providers. One downside for our application is in APNS you can only pass a full path for the certificate in PEM format. The same behaviour is in the original gem. For our solution is kind of bummer because we already have the PEMs in memory and we cannot access to a physical file in the machine the application runs. |
@maxintech - how do you place the PEM in memory? |
@astjohn: To be clear. Our application is a Gaming Platform. We serve more than one application. |
@maxintech, interesting. Well, if you want to take a kick at it, I could see a simple solution as making a I still haven't heard anything from @prockport regarding pulling the branch into this repo. |
Thank you @astjohn. I will add the issue on the Sitata branch/tracker. |
This is a chunk from my irb test. Can you tell me what I might be doing wrong or is the close method in conflict with persistence?
irb(main):007:0>APNS.start_persistence
=> true
irb(main):008:0> APNS.send_notification(device_token, 'tell me if you get this')
NoMethodError: undefined method
close' for nil:NilClass from /home/guruninja/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/pushmeup-0.3.0/lib/pushmeup/apns/core.rb:83:in
rescue in with_connection'from /home/guruninja/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/pushmeup-0.3.0/lib/pushmeup/apns/core.rb:72:in `with_connection'
The text was updated successfully, but these errors were encountered: