Skip to content

Instantly share code, notes, and snippets.

@bscott
Created June 18, 2013 06:06
Show Gist options
  • Select an option

  • Save bscott/5802979 to your computer and use it in GitHub Desktop.

Select an option

Save bscott/5802979 to your computer and use it in GitHub Desktop.
Process Queue via EM
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment