【问题标题】:Redis::InheritedError when calling Sidekiq workerRedis::InheritedError 调用 Sidekiq 工作者时
【发布时间】:2014-08-13 18:24:19
【问题描述】:

每当我打电话给 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 gem 连接到的 Redis Cloud。

这是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 url。

【问题讨论】:

    标签: ruby-on-rails ruby heroku redis sidekiq


    【解决方案1】:

    在您的 Web 服务器分叉之前不要触摸池,即在您的应用初始化期间不要触摸 Redis。

    【讨论】:

      【解决方案2】:

      您是否正在使用分叉网络服务器?

      在这种情况下,您可能需要从自述文件中添加这个 sn-p:https://github.com/mperham/sidekiq/wiki/Connecting-to-Redis#forking-app-server

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-06-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-08
        相关资源
        最近更新 更多