redis command get executed twice
Checklist
- Python version: 3.7
- Using hiredis
- Using uvloop
- Does issue exists against the
masterbranch of aredis? yes
Steps to reproduce
The symptom was a redis pipeline executed twice successfully in row while in run pipeline.execute() only one time.
My pipeline was executed here : https://github.com/NoneGG/aredis/blob/aecfafd06aa1a08d81538cd9ed2e11fc119bfb16/aredis/pipeline.py#L285
And another time here: https://github.com/NoneGG/aredis/blob/aecfafd06aa1a08d81538cd9ed2e11fc119bfb16/aredis/pipeline.py#L300
So I digged to understand why this ConnectionError occurs while this is not really a connection issue since the two send commands have succeed from redis point of view.
The root cause was that I mess up to run the redis command into the correct loop.
Asyncio raises a RuntimeError to inform developer in such case, but this one was hidden by aredis code here:
https://github.com/NoneGG/aredis/blob/master/aredis/connection.py#L313-L315
And RuntimeError was recasted to a ConnectionError, the working redis connection (but attached to another loop) get close, a new one was create bind to the current running loop, and the command is resent.
Expected behavior
aredis should not convert all exceptions into ConnectionError, it should catch only Exception related to connection issues.
Actual behavior
aredis convert any exception into ConnectionError and hide some programatic error occuring in caller code.
Sounds reasonable, i will check and fix it soon, thanks a lot~
@NoneGG I've also run into this exact problem