Continuously process work with EM::Queue
EM.run do
queue = EM::Queue.new
queue_work = Proc.new do |data|
Worker.new.call(data)
EM.next_tick { queue.pop(&queue_work) }
end
queue.pop(&queue_work)
queue.push("here's some data")
end
Written by Alex Sharp
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#