ActiveRecord允许您配置数据库read_timeout和write_timeout值,例如:
production:
adapter: mysql
encoding: utf8
database: mydb
pool: 5
username: myuser
password: mypass
host: myhost
write_timeout: 2
read_timeout: 10
read_timeout和write_timeout对ActiveRecord是唯一的,还是mysql规范的那些部分?我知道mysql有innodb_lock_wait_timeout的概念,但我不相信它与查询超时相同。
谢谢!
答案 0 :(得分:-1)
我从未使用过mysql gem。但我认为你可以看到ActiveRecord使用的mysql变量。
> ActiveRecord::Base.connection.execute('show variables like "%timeout%"').to_a
=> [["connect_timeout", "10"],
["delayed_insert_timeout", "300"],
["innodb_flush_log_at_timeout", "1"],
["innodb_lock_wait_timeout", "50"],
["innodb_rollback_on_timeout", "OFF"],
["interactive_timeout", "28800"],
["lock_wait_timeout", "31536000"],
["net_read_timeout", "30"],
["net_write_timeout", "60"],
["rpl_stop_slave_timeout", "31536000"],
["slave_net_timeout", "3600"],
["wait_timeout", "2147483"]]