Comments (6)
Ace! Thanks for the feedback ๐
from lowdown.
Hey, great to hear it works well for you in general!
Regarding your delayed issue, its a bit tough for me to judge just by this info what might be going on, I would need more info to be able to better help you diagnose the problem. I can tell you, however, that we are also using it from a DJ queue, the main thing there is that I do not call delay
on a Client
instance, but rather on a class method of our internal PushNotificationService
class which forwards that delayed call to the processโ Client
singleton instance.
from lowdown.
Thanks for your answer, alloy :) Good to see that someone managed to use it from a DJ queue.
I have a distinct class like this:
class SendPendingMessagesJob < ActiveJob::Base
queue_as :default
def perform(message)
end
end
And in the perform
method the Client
instance is created by calling production
and during that the whole job hangs until forever ๐
BTW: Without the initializer method the results are the same :(
from lowdown.
Hmm, Iโm thinking that maybe this is happening because youโre requiring the sources very early and thatโs triggering Celluloid to load and not work anymore after forking.
Could it be that you are e.g. letting Bundler load the Lowdown sources when your Rails app starts?
I have this in our Gemfile:
gem 'lowdown', require: false
And my internal client class actually differs slightly from the README example, in that it just-in-time requires Lowdown:
class PushNotificationService
def initialize(certificate_path)
@certificate_path = certificate_path
@client_mutex = Mutex.new
end
def client
client = nil
@client_mutex.synchronize do
require 'lowdown' # <-- just-in-time loading of Lowdown
@client ||= Lowdown::Client.production(true, File.read(certificate_path), keep_alive: true)
client = @client
end
client
end
end
This all makes sure that Lowdown, and in turn Celluloid, do not get loaded until they are actually needed.
Please let me know if this fixes it, in which case I will amend the README and also have another think about how to possibly make this simpler to use.
from lowdown.
Yes, that was exactly the point! Now it works. Thank you very much. ๐
Adding that to the readme would be an awesome idea.
from lowdown.
Thanks for showing off your implementation, @alloy. I ran into exactly this same issue and "lazy requiring" lowdown
was the fix. +1 for adding this to the README and/or a slightly modified approach.
from lowdown.
Related Issues (20)
- PEM cert with passphrase HOT 2
- Battle Testing HOT 22
- actor broken for IO is already registered with selector (on sidekiq job) HOT 12
- ERROR: Actor crashed! EOFError: end of file reached /Users/danolee/.rvm/rubi HOT 21
- stuck in thread with sidekiq HOT 11
- Apple Certificate HOT 17
- Apple feedback service HOT 1
- Actor crashed EOFError: end of file reached HOT 2
- 400 (Bad request): BadDeviceToken HOT 7
- TopicDisAllow HOT 13
- We are getting "Actor crashed! - ArgumentError: this IO is already registered with selector" exception when using a persistent connection HOT 1
- V2
- Android? HOT 1
- Include mutable-content in aps hash HOT 1
- Creating a persistent connection freezes the process HOT 3
- Put the worker thread to sleep if there is nothing to do. HOT 1
- Thread safe with sidekiq? HOT 3
- Long running singleton usage HOT 12
- [very low priority] doesn't work with spring and Rails 4.2.5 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lowdown.