我有一个使用 Resque 的 Ruby Rails 应用程序。
Resuqe 守护程序在运行一段时间后因错误而崩溃。我的第一个猜测是守护进程访问 MySQL 数据库的频率不够高(几个小时),所以我每 5 分钟触发一次访问数据库的队列项。但我仍然得到:
rake aborted!
Connection timed out
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:204:in `rescue in io'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:202:in `io'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:210:in `read'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:84:in `block in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:183:in `block (2 levels) in process'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:287:in `ensure_connected'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:173:in `block in process'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:248:in `logging'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:172:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis/client.rb:84:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:715:in `block in get'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:36:in `block in synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:36:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-3.0.2/lib/redis.rb:714:in `get'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/redis-namespace-1.2.1/lib/redis/namespace.rb:257:in `method_missing'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:517:in `job'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:450:in `unregister_worker'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:169:in `rescue in work'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/worker.rb:129:in `work'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/resque-1.23.0/lib/resque/tasks.rb:36:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => resque:work
(See full trace by running task with --trace)
我在我的方法中放置了一些日志文件输出,当触发任何异步任务时会调用该方法,但看起来连接超时是在不执行我的任何应用程序代码时发生的。
然后去哪儿?