EventMachine - how can you tell if you are behind?

I am studying using rubygem twitter-stream with EventMachine to track and record tweets. I’m kind of new to everything that happens in programming. How can I determine if any processing that I do in my event loop will affect it? Is there an easy way to check?

+5
source share
2 answers

EventMachine has a method EventMachine::Queue.sizethat allows you to look into the current queue and get an idea of ​​how big it is.

add_periodic_timer()In this case, you can also get the size of the queue and print it.

, . , .

+3

. 1 , 1 , , , .

@last = Time.now.to_f
EM.add_periodic_timer(1) do
  puts "LATENCY: #{Time.now.to_f - @last}"
  @last = Time.now.to_f
end 
+7

All Articles