I'm using em-twitter to track the /1.1/statuses/filter.json api.
An example code that includes a periodic timer would like below :
EM.run do
client = EM::Twitter::Client.connect(options)
client.each do |status|
# handle_tweet ...
end
EM.add_periodic_timer(5) do
# other job
end
end
So the question is, since every 5 seconds event loop will jump to other job (e.g. an async connection to database), will this potentially lose some streaming data we are tracking at this point of time?
I would advise not blocking the event loop inside your timer. But theoretically, no, I don't think this would prevent data from being received. I believe your data would be handled in the next tick.
Hi,
I'm using
em-twitter
to track the/1.1/statuses/filter.json
api.An example code that includes a periodic timer would like below :
So the question is, since every 5 seconds event loop will jump to other job (e.g. an async connection to database), will this potentially lose some streaming data we are tracking at this point of time?
Thanks