p5-RedisDB / RedisDB

Perl extension to access Redis
22 stars 11 forks source link

Setting _in_multi before checking the connection #32

Open chengyang-binary opened 5 years ago

chengyang-binary commented 5 years ago

Hi,

The $redis->multi; line below fails when the connection is dropped (before calling the code).

We gone through the code and realised that if multi is called even when the connection is dropped, it first sets the _in_multi to true, then it checks the connection, then throws error. (https://github.com/trinitum/RedisDB/blob/master/lib/RedisDB.pm#L1664)

Is that intended behaviour ? It would be great if it checks for connection and throws error before setting the flag. That would cause it to not pass through multiple subroutines before realising there is no connection then throws an error, which causes it harder to debug.

Thanks!

trinitum commented 5 years ago

Hi,

it's a good point, but not exactly straightforward to implement. I unfortunately don't have time to work on this. If you can implement it and submit a PR I'll merge it.