nomad-cli / houston

Apple Push Notifications; No Dirigible Required
http://nomad-cli.com
MIT License
2.93k stars 229 forks source link

Persisted connections are not re-connecting in case they are dropped #76

Closed hubertlepicki closed 3 years ago

hubertlepicki commented 10 years ago

This is not entirely Houston's fault, but the way Ruby Sockets work. When the server looses connection to Apple gateways, Houston knows nothing about it and connection#open? will still return true. Moreover, you seem to be able to write to such dead connection, yet nothing is delivered to Apple.

Underlying TCPConnection that is being opened to Apple is not working properly, yet we know nothing about it.

I have too little experience with Ruby TCP programming to solve it myself. But if someone can point me to right direction I could create a patch and pr.

Any ideas how to solve this?

joefiorini commented 10 years ago

Potentially related to #77?

micred commented 9 years ago

Almost an year ago a guy has resolved by himself: http://joshsymonds.com/blog/2013/10/17/sidekiq-plus-houston-production-ready/ Maybe is maintainer consider the code safe, it will be cool to have the begin-rescue-5attemps code imported in the gem.

wimhaanstra commented 9 years ago

@micred I am using your solution, but I still have the problem when a token is invalid, it completely stops sending push notifications. The connection.open? method still returns true, but this does not seem to be correct.

micred commented 9 years ago

yeah, I know :-( To fix that problem (as a temporary workaround) I have added a "sleep 0.2" between each message sent.

wimhaanstra commented 9 years ago

That does not solve my problem. I already filter out old tokens but sometimes there is a token in my database that isn't valid and every notification after that token is not receiving a push message. :(

ferrous commented 9 years ago

A lazy wrap with reset on CLOSE_WAIT connections (working on linux) https://gist.github.com/ferrous/d498971be300683c3bbd