mloughran / em-hiredis

Eventmachine redis client
MIT License
221 stars 63 forks source link

RuntimeError: eventmachine not initialized: evma_connect_to_server #43

Closed gabrieltong closed 8 years ago

gabrieltong commented 9 years ago

Hey I'm a new guy to em-hiredis, so I don't know much. my steps are

  1. add to gemfile gem 'em-hiredis', and bundle install
  2. in my some method, I run
require 'em-hiredis'
redis = EM::Hiredis.connect

the second will raise this error

Litchiware commented 8 years ago

You can run your codes this way:

require 'em-hiredis'
EM.run {
  redis = EM::Hiredis.connect
  ...
}