Skip to content
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

Unexpected UNWATCH after pipeline EXEC #1299

Closed
nickgaya opened this issue Mar 5, 2020 · 1 comment
Closed

Unexpected UNWATCH after pipeline EXEC #1299

nickgaya opened this issue Mar 5, 2020 · 1 comment

Comments

@nickgaya
Copy link
Contributor

nickgaya commented Mar 5, 2020

Version:
Redis-py 3.4.1
Redis 5.0.7

Platform:
Python 3.8.2
Mac OS 10.13.6

Description:
When executing a transaction with watched keys, Pipeline.execute() does not clear the watching state of the pipeline object, so a subsequent call to Pipeline.reset() will send an extra UNWATCH command to the server.

Example:

from redis import Redis
redis = Redis(...)

with redis.pipeline() as pipe:
    pipe.watch("key")
    pipe.get("key")
    pipe.multi()
    pipe.set("key", "value")
    pipe.execute()

Redis monitor output:

1583397021.463844 [0 172.17.0.1:50360] "WATCH" "key"
1583397021.465269 [0 172.17.0.1:50360] "GET" "key"
1583397021.466502 [0 172.17.0.1:50360] "MULTI"
1583397021.466524 [0 172.17.0.1:50360] "SET" "key" "value"
1583397021.466531 [0 172.17.0.1:50360] "EXEC"
1583397021.467971 [0 172.17.0.1:50360] "UNWATCH"
@andymccurdy
Copy link
Contributor

Thanks, merged in 9c8be70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants