database.yml in Rails reconnect set to true or false -
in database.yml
, default settings reconnect
on rails 3 , 4 false
. common setting, , in circumstances should set true
? thanks.
you can set true. option introduced in rails 2.3
mysql supports reconnect flag in connections - if set true, client try reconnecting server before giving in case of lost connection. can set reconnect = true mysql connections in database.yml behavior rails application.
rails team set option default 'false' because, don't want change behavior of existing applications.
but side effects there if set reconnect = true
. not transaction-safe.the mysql documentation in fact explicitly states auto-reconnect feature affects transactions.
any active transactions rolled , autocommit mode reset.
applications not written deal break. documentation lists number of other side effects caused auto-reconnect feature, of cause applications not written anticipate behavior function incorrectly or fail.
check:
Comments
Post a Comment