Permalink
Browse files

Merge pull request #16 from jtoy/master

fix cpu usage bug
  • Loading branch information...
2 parents 73c883e + c0ca5d7 commit 00cea919a3f567ee324d61e2e03e865c420f3838 @dj2 dj2 committed Jun 8, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/em-jack/connection.rb
@@ -230,11 +230,9 @@ def put(msg, opts = nil, &blk)
def each_job(timeout = nil, &blk)
if (@fiberized)
work = Proc.new do
- Fiber.new do
- job = reserve(timeout)
- blk.call(job)
- end.resume
- EM.next_tick { work.call }
+ job = reserve(timeout)
+ blk.call(job)
+ EM.next_tick { Fiber.new { work.call }.resume }
end
else
work = Proc.new do

0 comments on commit 00cea91

Please sign in to comment.