我正在尝试并行执行多个 redis 查询,但出现错误:
/var/lib/gems/1.9.1/gems/em-synchrony-1.0.2/lib/em-synchrony.rb:53:in `resume':
dead fiber called (FiberError)
这是代码:
require 'em-synchrony'
require 'redis/connection/synchrony'
require 'redis'
redis = EM::Synchrony::ConnectionPool.new(size: 4) do
Redis.new
end
EM.synchrony do
multi = EM::Synchrony::Multi.new
multi.add :a, redis.alpush('foo', 1)
multi.add :b, redis.alpush('foo', 2)
res = multi.perform
p res
EM.stop
end
请帮忙