mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Sentinel: drop the renamed-command entry in a more natural way.
Instead of telling the user to set the renamed command to "" to remove the renaming, to the obvious thing when a command is renamed to itself. So if I want to remove the renaming of PING, I just rename it to PING again.
This commit is contained in:
parent
8ba670f55c
commit
fc0c9c8097
@ -3469,19 +3469,16 @@ void sentinelSetCommand(client *c) {
|
||||
ri->quorum = ll;
|
||||
changes++;
|
||||
} else if (!strcasecmp(option,"rename-command") && moreargs > 1) {
|
||||
/* rename-command <oldname> <newname>
|
||||
*
|
||||
* Note: if newname is the empty string the command renaming
|
||||
* entry is deleted. */
|
||||
/* rename-command <oldname> <newname> */
|
||||
sds oldname = c->argv[++j]->ptr;
|
||||
sds newname = c->argv[++j]->ptr;
|
||||
|
||||
/* Remove any older renaming for this command. */
|
||||
dictDelete(ri->renamed_commands,oldname);
|
||||
|
||||
/* If the target name length is not zero, we need to add the
|
||||
* actual entry to the renamed table. */
|
||||
if (sdslen(newname)) {
|
||||
/* If the target name is the same as the source name there
|
||||
* is no need to add an entry mapping to itself. */
|
||||
if (!dictSdsKeyCaseCompare(NULL,oldname,newname)) {
|
||||
oldname = sdsdup(oldname);
|
||||
newname = sdsdup(newname);
|
||||
dictAdd(ri->renamed_commands,oldname,newname);
|
||||
|
Loading…
Reference in New Issue
Block a user