Skip to content

Commit

Permalink
Disconnect when execution is cancelled (NoneGG#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwestcott authored Oct 19, 2020
1 parent 642480d commit b46e671
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aredis/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
from itertools import chain

import aredis
from aredis.client import (StrictRedis, StrictRedisCluster)
from aredis.exceptions import (AskError, ClusterTransactionError, ConnectionError, ExecAbortError, MovedError,
RedisClusterException, RedisError, ResponseError, TimeoutError, TryAgainError,
Expand Down Expand Up @@ -283,7 +284,7 @@ async def execute(self, raise_on_error=True):

try:
return await exec(conn, stack, raise_on_error)
except (ConnectionError, TimeoutError) as e:
except (ConnectionError, TimeoutError, aredis.compat.CancelledError) as e:
conn.disconnect()
if not conn.retry_on_timeout and isinstance(e, TimeoutError):
raise
Expand Down

0 comments on commit b46e671

Please sign in to comment.