Reduce slow DCB shutdown timeout to 2 seconds

This helps reduce the effect that a hanging connection has on the whole
system.

Making this configurable shouldn't be needed as long as the rate of
authentication failures doesn't exceed an acceptable level. In most
practical cases allowing two seconds for authentication to complete should
be enough.
This commit is contained in:
Markus Mäkelä 2020-08-21 09:20:58 +03:00
parent c5b47389df
commit df87df3a0d
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -165,9 +165,10 @@ void modules_thread_finish()
bool can_close_dcb(DCB* dcb)
{
const int SHOW_SHUTDOWN_TIMEOUT = 2;
auto idle = MXS_CLOCK_TO_SEC(mxs_clock() - dcb->last_read);
return idle > 5 // Timed out
return idle > SHOW_SHUTDOWN_TIMEOUT // Timed out
|| !dcb->func.can_close // Not implemented
|| dcb->func.can_close(dcb); // Protocol says it's OK to close
}