2014-06-23 26 views
0

每當我叫Sidekiq工作者,我發現了以下錯誤:的Redis :: InheritedError時調用Sidekiq工人

Redis::InheritedError (Tried to use a connection from a child process without reconnecting. You need to reconnect to Redis after forking.) 

我託管在Heroku上,並使用我連接到與connection_pool這Redis的雲寶石。

這裏的redis.rb:

if Rails.configuration.redis_uri.present? 
    $redis = ConnectionPool.new(:size => 8, :timeout => 30) do 
    Redis.new(:url => Rails.configuration.redis_uri) 
    end 
end 

但sidekiq甚至用這個,因爲它是直接從REDIS_URL環境變量中獲得Redis的網址,而不要認爲。

回答

1

請勿觸摸池前,您的Web服務器已經分叉,即你的應用程序的初始化過程中不要觸摸Redis的。