brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.64k stars 114 forks source link

sucker_punch with grocer to send push notifications through APNS on Heroku, persistent connection? #40

Closed silentdth closed 11 years ago

silentdth commented 11 years ago

Is it possible to keep a persistent connection with a sucker_punch job, so that it is reused every time a job is called? This is for the Apple APNS to send push notifications using the grocer gem on heroku.

Thanks.

brandonhilkert commented 11 years ago

I'm not sure this has anything to do with sucker_punch, honestly. Let's assume you create that connection outside of your job and it's global, you could easily use that connection in your sucker_punch job. I would be slightly worried about it blocking though if it's in use and you can only have one open, especially if you queue up many jobs at once. The Celluloid queue worker minimum is 2, so 2 workers will always be executing jobs in that queue, so there's a potential that one could be waiting for the connection to become available.

silentdth commented 11 years ago

Thanks Brandon, appreciate the comments.