I am trying to perform several redis queries in parallel, but getting an error:
/var/lib/gems/1.9.1/gems/em-synchrony-1.0.2/lib/em-synchrony.rb:53:in `resume':
dead fiber called (FiberError)
here is the code:
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
please help
Use the Eventmachine specific
em-hiredis
gem instead of the default driver.gem install em-hiredis
Anywhere
EM::Synchrony
is used, it is usually suggested to use the synchrony specific library shipped withem-synchrony
. That is why the statementem-synchrony/em-hiredis
and notrequire em-synchrony
.