ruby-on-rails – postgresql中的数据库连接超时错误
发布时间:2020-12-17 03:37:55 所属栏目:百科 来源:网络整理
导读:目前正在使用sidekiq运行backgroud作业,同时运行它的“ActiveRecord :: ConnectionTimeoutError”. This is my current database.yml file,production: adapter: postgresql encoding: unicode database: app_production username: password password: host:
目前正在使用sidekiq运行backgroud作业,同时运行它的“ActiveRecord :: ConnectionTimeoutError”.
This is my current database.yml file,production: adapter: postgresql encoding: unicode database: app_production username: password password: host: app.domain.com pool: 25 这是我的sidekiq.yml文件, production: concurrency: 25 timeout: 300 在运行其给定连接超时错误时 这个错误是在背景中, could not obtain a database connection within 5 seconds (waited 5.82230675 seconds). The max pool size is currently 25; consider increasing it. 解决方法
您的postgres数据库允许的最大连接数为25.但是您已将sidekiq的并发设置为25.因此,如果您运行sidekiq的所有并发线程,则您的应用服务器将无法使用任何数据库连接.
减少sidekiq并发性或增加池大小(我建议增加池大小). Postgres默认允许100个并发连接 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |