Skip to content

TransactionStrategy reset: UNWATCH only when status is watching #3671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions redis/asyncio/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2352,8 +2352,9 @@ async def reset(self):
try:
# call this manually since our unwatch or
# immediate_execute_command methods can call reset()
await self._transaction_connection.send_command("UNWATCH")
await self._transaction_connection.read_response()
if self._watching:
await self._transaction_connection.send_command("UNWATCH")
await self._transaction_connection.read_response()
# we can safely return the connection to the pool here since we're
# sure we're no longer WATCHing anything
self._transaction_node.release(self._transaction_connection)
Expand Down
5 changes: 3 additions & 2 deletions redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3292,8 +3292,9 @@ def reset(self):
try:
# call this manually since our unwatch or
# immediate_execute_command methods can call reset()
self._transaction_connection.send_command("UNWATCH")
self._transaction_connection.read_response()
if self._watching:
self._transaction_connection.send_command("UNWATCH")
self._transaction_connection.read_response()
# we can safely return the connection to the pool here since we're
# sure we're no longer WATCHing anything
node = self._nodes_manager.find_connection_owner(
Expand Down