diff --git a/lib/Base_Session.cpp b/lib/Base_Session.cpp index 5947f532d..20eeaa4bb 100644 --- a/lib/Base_Session.cpp +++ b/lib/Base_Session.cpp @@ -180,10 +180,13 @@ void Base_Session::writeout() { int total_written = 0; unsigned long long last_sent_=0; int tmbpstc = 0; // throttle_max_bytes_per_second_to_client + enum proxysql_session_type _tmp_session_type_cmp1; if constexpr (std::is_same::value) { tmbpstc = mysql_thread___throttle_max_bytes_per_second_to_client; + _tmp_session_type_cmp1 = PROXYSQL_SESSION_MYSQL; } else if constexpr (std::is_same::value) { tmbpstc = pgsql_thread___throttle_max_bytes_per_second_to_client; + _tmp_session_type_cmp1 = PROXYSQL_SESSION_PGSQL; } else { assert(0); } @@ -191,16 +194,25 @@ void Base_Session::writeout() { int mwpl = tmbpstc; // max writes per call mwpl = mwpl/tps; // logic to disable throttling - if constexpr (std::is_same::value) { - if (session_type!=PROXYSQL_SESSION_MYSQL) { - disable_throttle = true; - } + + if (session_type != _tmp_session_type_cmp1) { + disable_throttle = true; } - if constexpr (std::is_same::value) { - if (session_type != PROXYSQL_SESSION_PGSQL) { - disable_throttle = true; + + if (client_myds) client_myds->array2buffer_full(); + if (mybe && mybe->server_myds && mybe->server_myds->myds_type == MYDS_BACKEND) { + if (session_type == _tmp_session_type_cmp1) { + if (mybe->server_myds->net_failure == false) { + if (mybe->server_myds->poll_fds_idx > -1) { // NOTE: attempt to force writes + mybe->server_myds->array2buffer_full(); + } + } + } + else { + mybe->server_myds->array2buffer_full(); } } + if (client_myds && thread->curtime >= client_myds->pause_until) { if (mirror==false) { bool runloop=false;