-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Execute empty MULTI #2423
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
Execute empty MULTI #2423
Conversation
When calling exec on a multi instance which you did not use, no command is sent currently. This is a problem for watched keys, because no EXEC means no unwatch, which might cause hard-to-debug problems. Proposed Fix: Sending UNWATCH
@Mik13 good catch!
I need to think about that more... |
Hi @leibale! To 1: Agree I do not understand the project good enough how we could possibly catch the watch inside of the multi-command when issued outside of course. That would be perfect, if it does not add too much complexity. |
@Mik13 checking if // instead of:
const multi = client.multi();
await client.watch('key');
if (shouldRun()) {
multi.set('a', 'b');
}
await multi.exec();
// do:
if (shouldRun()) {
await Promise.all([
client.watch('key'),
client.multi()
.set('a', 'b')
.exec();
]);
} @guyroyse we need your opinion here.. :) |
My thought is that we should call what the user told us to call. If I call MULTI and then call EXEC without doing anything else, then that's what I asked for and that's what I should get. It's cleaner and, more importantly, provides unsurprising behavior to the user. |
Codecov ReportBase: 95.60% // Head: 95.59% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #2423 +/- ##
==========================================
- Coverage 95.60% 95.59% -0.01%
==========================================
Files 455 455
Lines 4550 4545 -5
Branches 520 519 -1
==========================================
- Hits 4350 4345 -5
- Misses 128 130 +2
+ Partials 72 70 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lack of a space before as
in places like [C in keyof M[P]as ExcludeMappedString<C>]
makes me twitch a bit but this looks good to me otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
Thank you two for the fast responses!
Description
Currently, calling
.exec()
on an "empty" multi command (without calling any other command on it), is not executingMULTI EXEC
on the server.This can cause problems when using
WATCH
, because noMULTI EXEC
means the key is still watched.Fix
Execute
MULTI EXEC
even if the multi is empty.