Fix database connection keep alive
Review Request #96 - Created Nov. 3, 2009 and submitted
Information | |
---|---|
Bogdan-Cristian Tătăroiu | |
infoarena | |
Reviewers | |
hackers | |
This should fix the eval crashing when it is unable to connect to the database server. We already had some keep alive system implemented, but when an attempt to reconnect failed the first time the db_connect function would log_error and the eval would stop.
Shouldn't $timeout be reseted when a connection is established again? If we have 10 failed attempts, but the DB link is acquired again, on the next failed attempt (say, one month later), timeout will still be maxed out at 60.
-
trunk/common/db/db_mysql.php (Diff revision 2) -
Why don't we use IA_DB_KEEP_ALIVE instead of adding another parameter to the db_connect function. I don't think we'll ever need to use db_connect(false). This could also lead to wrong output if IA_DB_KEEP_ALIVE is true and $try_keepalive is false. In case the connection fails we would log_warn("Retrying...") and we wouldn't be doing that.
-
trunk/common/db/db_mysql.php (Diff revision 2) -
split this in something like: log_warn($log_message); if ($try_keepalive) { ... log_warn($log_message); } Either this either remove the $try_keepalive parameter.
Review request changed
Change Summary:
Moved retry code from db_keepalive to db_connect for cleaner code.
Diff: |
Revision 3 (+23 -11) |
---|