informatikr / hedis

A Redis client library for Haskell.
http://hackage.haskell.org/package/hedis
BSD 3-Clause "New" or "Revised" License
330 stars 125 forks source link

`timeout` instead of `race` to fix async wait time #222

Open g-divyanshu opened 7 months ago

g-divyanshu commented 7 months ago

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.