Skip to content

Pipeline#discard() replacement since Jedis version 4 #3505

Closed Locked Answered by sazzad16
informatik01 asked this question in Q&A
Discussion options

You must be logged in to vote

discard() is also unnecessary even if your are using transaction but not in transaction mode.

exec() declares the end of a transaction mode irrespective of it's success or failure. So after calling exec(), even if it fails, there is not an active transaction anymore. That's why I'm saying that discard() is unnecessary in your code.

Usually in same code flow you use either EXEC or DISCARD, not both. You call EXEC to try completing the transaction. Or call DISCARD to abort. You don't need DISCARD after EXEC because if the EXEC is successful the transaction is completed and if the EXEC is failed the transaction is aborted (already).

I guess, if it were (current) me, I would've written your c…

Replies: 6 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sazzad16
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@sazzad16
Comment options

@informatik01
Comment options

@sazzad16
Comment options

Answer selected by informatik01
@informatik01
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants