2012-09-27 22 views
0

我正在使用Resque 1.22.0,Resque-status 0.3.3,並且都運行正常。如果我有救援的UI寶石,我得到的錯誤(從隊列):Resque-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的用戶界面,並放置在前臺工作正常。沒有人有任何想法如何解決這一問題:很讓人討厭......

回答

0

即是大問題之一resque一會兒看過來檢查過here

它像MySQL連接要走了問題,當一個fork退出

它關閉所有它的連接只是在這裏的差異是mysql而是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 

如何這一點,你就可以解決這個

一)更新resque

也有多種方式解決(用了一段時間,但現在這個補丁更新resque)看到了here

b)若您更新用不看,那麼你可以做到這一點使用resque_hooks這樣的事情

Resque.after_fork do 
    Resque.redis.client.reconnect 
end 

c)升級Redis服務器: - 這完全確定這一點,但我注意到Redis 2.4.6 不確定該版本,儘管通過redis在內部實現了重新連接(不確定它是否是redis或redis客戶端,但可以肯定地認爲重新含蓄地發生)

希望這有助於

0

試圖找出resque進程號,中止並重新啓動服務器resque。

此外,你可以嘗試下面的

Redis.current.client.reconnect 
$redis = Redis.current 
相關問題