lib/em-synchrony/em-redis.rb in em-synchrony-0.2.0 vs lib/em-synchrony/em-redis.rb in em-synchrony-0.3.0.beta.1
- old
+ new
@@ -19,25 +19,27 @@
conn = self.aconnect(*args)
conn.callback { f.resume(conn) }
Fiber.yield
end
-
+
+ alias :old_call_command :call_command
+
def call_command(argv, &blk)
# async commands are 'a' prefixed, but do check
# for the 'add' command corner case (ugh)
if argv.first.size > 3 && argv.first[0] == 'a'
argv[0] = argv[0].to_s.slice(1,argv[0].size)
- callback { raw_call_command(argv, &blk) }
+ old_call_command(argv, &blk)
else
# wrap response blocks into fiber callbacks
# to emulate the sync api
f = Fiber.current
blk = proc { |v| v } if !block_given?
clb = proc { |v| f.resume(blk.call(v)) }
- callback { raw_call_command(argv, &clb) }
+ old_call_command(argv, &clb)
Fiber.yield
end
end
end
end
\ No newline at end of file