From 95e62b0b4b9cf0fb2861a9c10688a68e1f54b4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sat, 4 Apr 2020 00:42:57 +0200 Subject: [PATCH] Minor opimization on previous commit --- lib/MySQL_HostGroups_Manager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 178eb066c..cce7f218e 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -2685,10 +2685,12 @@ MySQL_Connection * MySrvConnList::get_random_MyConn(MySQL_Session *sess, bool ff unsigned int i; unsigned int l=conns_length(); bool needs_warming = false; - unsigned int total_connections = mysrvc->ConnectionsFree->conns_length()+mysrvc->ConnectionsUsed->conns_length(); - unsigned int expected_warm_connections = mysql_thread___free_connections_pct*mysrvc->max_connections/100; - if (mysql_thread___connection_warming && (total_connections < expected_warm_connections)) { - needs_warming = true; + if (mysql_thread___connection_warming) { + unsigned int total_connections = mysrvc->ConnectionsFree->conns_length()+mysrvc->ConnectionsUsed->conns_length(); + unsigned int expected_warm_connections = mysql_thread___free_connections_pct*mysrvc->max_connections/100; + if (total_connections < expected_warm_connections) { + needs_warming = true; + } } if (l && ff==false && needs_warming==false) { if (l>32768) {