dovecot-2.1: lib-sql: Don't try to connect to connections that a...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 16 16:59:32 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/3955a5b2a917
changeset: 13494:3955a5b2a917
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 15 13:48:26 2011 +0300
description:
lib-sql: Don't try to connect to connections that are going to be reconnected later.
This avoids unnecessarily trying to connect to failing connections.

diffstat:

 src/lib-sql/driver-sqlpool.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 55552b4e8c65 -r 3955a5b2a917 src/lib-sql/driver-sqlpool.c
--- a/src/lib-sql/driver-sqlpool.c	Thu Sep 15 13:47:44 2011 +0300
+++ b/src/lib-sql/driver-sqlpool.c	Thu Sep 15 13:48:26 2011 +0300
@@ -309,7 +309,7 @@
 		if (conns[idx].host_idx == unwanted_host_idx)
 			continue;
 
-		if (!SQL_DB_IS_READY(conndb)) {
+		if (!SQL_DB_IS_READY(conndb) && conndb->to_reconnect == NULL) {
 			/* see if we could reconnect to it immediately */
 			(void)sql_connect(conndb);
 		}
@@ -523,7 +523,8 @@
 	int ret = -1, ret2;
 
 	array_foreach(&db->all_connections, conn) {
-		ret2 = sql_connect(conn->db);
+		ret2 = conn->db->to_reconnect != NULL ? -1 :
+			sql_connect(conn->db);
 		if (ret2 > 0)
 			return 1;
 		if (ret2 == 0)


More information about the dovecot-cvs mailing list