Problem Statement: In an application deployed in my organisation, we were seeing an increased time to connect to redis, when we increased the value of connectTimeout.
Reason: This was happening because of the higher timeout value which was being passed to race in connect function as timeoutOpt. Function race internally calls cancel and cancel will not terminate until the thread that Async refers to has been terminated.
Solution : Used timeout function instead of race to handle that scenario and now it works fine.
Problem Statement: In an application deployed in my organisation, we were seeing an increased time to connect to redis, when we increased the value of
connectTimeout
.Reason: This was happening because of the higher timeout value which was being passed to
race
inconnect
function astimeoutOpt
. Functionrace
internally callscancel
and cancel will not terminate until the thread that Async refers to has been terminated.Solution : Used timeout function instead of
race
to handle that scenario and now it works fine.