Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 315 forks source link

Fix "RedisCluster object has no attribute connection" error #434

Closed levkk closed 3 years ago

levkk commented 3 years ago

433

Comment explains why this seems necessary.

RedisCluster class assumes that initialization errors are not recoverable. It throws the exception in the constructor before calling its parent class constructor, causing its parent class __del__ encounter an undefined attribute on clean up.

This change allows for the parent class to cleanly shutdown so the calling code can try again.