我使用的是Resque 1.22.0,Resque-status 0.3.3,一切运行正常。如果我包含救援-ui,我会得到错误(来自队列):
failed: #<Redis::InheritedError: Tried to use a connection from a child process without reconnecting. You need to reconnect to Redis after forking.>从rake任务代码中删除resque-ui,并将其保留在前台可以正常工作。有没有人知道怎么解决这个问题:非常恼人......
发布于 2012-10-29 00:46:55
这是一段时间以来在resque中的一个大问题在这里查看here
它有点像fork退出时mysql连接消失问题
它关闭了所有it连接,只是这里的区别是不是mysql it redis
因此,简单来说,情况是这样的
#### Resque main worker
redis = Redis.new
while(true) do
#### Parent redis connection
redis.blpop(* queue_name)
#### redis queue are polled and message are consumed
#### Resque internally fork to performer the task
fork {
#### This fork used the redis connection from the main worker
#### On exit the fork close the redis connection
##### Perform the background task
}
end
## On Main Worker when the the resque try to use the same connection that was closed it raise the above error 如何解决这个问题?
有很多种方法可以解决这个问题
a)更新resque (花了一段时间,但现在补丁更新是resque ),请通过here查看
b)如果您没有查看更新,那么您可以使用resque_hooks来实现这一点,如下所示
Resque.after_fork do
Resque.redis.client.reconnect
endc)升级Redis服务器:-这是完全肯定的,但我不确定Redis 2.4.6的版本,尽管重新连接是通过redis内部实现的(不确定是redis还是redis客户端,但我认为重新连接是隐式发生的)
希望这对你有所帮助
发布于 2014-11-25 15:54:33
尝试识别resque进程id,终止它,然后重新启动resque服务器。
此外,您还可以尝试以下方法
Redis.current.client.reconnect
$redis = Redis.currenthttps://stackoverflow.com/questions/12630714
复制相似问题