新手问题 Resque 执行 worker 报错

u1453357893 · 2016年04月11日 · 1759 次阅读

我在本地执行 worker 的时候如下:

rake resque:work QUEUE='*'

执行的时候 worker 都可以正常的跑 可是我在 config/initializers/ 下加了一个 redis.rb 文件 code 如下:

$redis_conf = YAML.load_file("#{Rails.root}/config/redis.yml")[Rails.env].with_indifferent_access
Redis.current = Redis.new(host: $redis_conf['host'], port: $redis_conf['port'], timeout: 300, driver: :hiredis)
$redis = Redis.current
Resque.redis = $redis

(我想用$reids 在 model 层进行 redis 交互) 就是加了 redis 的全局变量,感觉没有问题啊,再次执行 rake resque:work QUEUE='*' 报如下:

WARNING: This way of doing signal handling is now deprecated. Please see http://hone.heroku.com/resque/2012/08/21/resque-signals.html for more info.
dyld: lazy symbol binding failed: Symbol not found: _rb_thread_select
  Referenced from: /Users/qdailyfiles/.rvm/gems/ruby-2.3.0/gems/hiredis-0.4.5/lib/hiredis/ext/hiredis_ext.bundle
  Expected in: flat namespace

dyld: Symbol not found: _rb_thread_select
  Referenced from: /Users/qdailyfiles/.rvm/gems/ruby-2.3.0/gems/hiredis-0.4.5/lib/hiredis/ext/hiredis_ext.bundle
  Expected in: flat namespace

Trace/BPT trap: 5

我删除 redis.rb 后就没有这个问题了 请问是什么原因? 补充:环境变量也配置成功了如下:

#<Redis client v3.2.2 for redis://localhost:6379/0>
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号