Railsdatabase.yml超时是什么单位?

What units is timeout in Rails database.yml?

在database.yml中,超时是秒还是毫秒?具体是什么,整个数据库连接的超时,包括连接等待时间或其他?

超时以毫秒为单位。这是 rails 应用程序等待数据库响应的全部时间。好的做法是在此文件中添加重新连接选项,然后应用程序将尝试重新连接到服务器,然后在连接丢失的情况下放弃。

在放弃和引发超时错误之前阻塞和等待连接的秒数(默认 5 秒)。

wait_timeout: 900 # 15 minutes.
timeout: 5000 # 5 seconds.

MYSQL 文档说:

 1. wait_timeout : The number of seconds the server waits for activity on a
   noninteractive connection before closing it. The default value is 28800.

 2. connect_timeout : The number of seconds that the mysqld server waits for
   a connect packet before responding with Bad handshake. The default value is 10 seconds.

connect_timeout mysql 映射到 timeout 定义在 data_base.yml rails 默认设置为 5 秒。

如果使用checkout_timeout,单位是秒。