In daemon, which tracks twitter-stream I have this construction:
client.track(*hashtags) do |status|
if status.coordinates != nil
EventMachine.synchrony
job = Qu.enqueue TweetProcessor, status
puts "Enqueued tweet processing #{job.id}"
end
end
end
For ques library I’m using qu-mongo I have this config
# /config/initializers/qu.rb
Qu.configure do |c|
c.connection = Mongo::Connection.new('127.0.0.1').db("appname_qu")
end
I’ve tried many options, but it always results with IOError: closed stream.
This problem is related to this question. More on this you can read here. So, in my case I’ve just reassign rails’ logger and qu’s loggers to the same file in the beginning of daemon’s cycle and close it in the end, and everything is working out just fine: