我在我的Prod服务器上偶尔会收到这个错误。ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 secondsthreads 2, 100database.ymlRuby ruby:2.3puma (3.11.2)db.m5.large
每10个小时左右,该应用程序就无法使用。每当用户尝试连接时,都会显示以下错误消息:
Error during failsafe response: could not obtain a database connection within 5.000我读过,这是因为数据库连接池已经满了,所以必须在rails应用程序中创建线程,当线程完成时不会关闭到数据库的连接。据我所知,在应用程序代码中只有一个地方可以使用线程:一个块使用Ruby超时模块,但这不能访问
当我在本地(C9.io,还没有试过live )工作时,我得到了这个特定的错误。当有很多用户在使用我的聊天对话时,就会发生这种情况。此外,当我在platform...the CPU级别的天空火箭上工作一段时间时,我注意到了这一点。是什么导致了这种情况?Puma caught this error: could not obtain a connection from the pool within 5.000 seconds (waited 5.022