Unverified Commit 25298191 authored by yoav-steinberg's avatar yoav-steinberg Committed by GitHub
Browse files

XADD - skip rewrite the id arg if it was given and is valid. (#9599)

When calling `XADD` with a predefined id (instead of `*`) there's no need to run
the code which replaces the supplied id with itself. Only when we pass a wildcard
id we need to do this.
For apps which always supply their own id this is a slight optimization.
parent 484a1ad6
...@@ -1841,9 +1841,11 @@ void xaddCommand(client *c) { ...@@ -1841,9 +1841,11 @@ void xaddCommand(client *c) {
/* Let's rewrite the ID argument with the one actually generated for /* Let's rewrite the ID argument with the one actually generated for
* AOF/replication propagation. */ * AOF/replication propagation. */
robj *idarg = createObjectFromStreamID(&id); if (!parsed_args.id_given) {
rewriteClientCommandArgument(c,idpos,idarg); robj *idarg = createObjectFromStreamID(&id);
decrRefCount(idarg); rewriteClientCommandArgument(c, idpos, idarg);
decrRefCount(idarg);
}
/* We need to signal to blocked clients that there is new data on this /* We need to signal to blocked clients that there is new data on this
* stream. */ * stream. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment