XGROUP DESTROY implemented.

This commit is contained in:
antirez 2018-06-04 12:58:26 +02:00
parent 86de089a1e
commit 7c6f1be5df

View File

@ -1542,7 +1542,6 @@ NULL
/* Certain subcommands require the group to exist. */ /* Certain subcommands require the group to exist. */
if ((cg = streamLookupCG(s,grpname)) == NULL && if ((cg = streamLookupCG(s,grpname)) == NULL &&
(!strcasecmp(opt,"SETID") || (!strcasecmp(opt,"SETID") ||
!strcasecmp(opt,"DELGROUP") ||
!strcasecmp(opt,"DELCONSUMER"))) !strcasecmp(opt,"DELCONSUMER")))
{ {
addReplyErrorFormat(c, "-NOGROUP No such consumer group '%s' " addReplyErrorFormat(c, "-NOGROUP No such consumer group '%s' "
@ -1569,7 +1568,14 @@ NULL
sdsnew("-BUSYGROUP Consumer Group name already exists\r\n")); sdsnew("-BUSYGROUP Consumer Group name already exists\r\n"));
} }
} else if (!strcasecmp(opt,"SETID") && c->argc == 5) { } else if (!strcasecmp(opt,"SETID") && c->argc == 5) {
} else if (!strcasecmp(opt,"DELGROUP") && c->argc == 4) { } else if (!strcasecmp(opt,"DESTROY") && c->argc == 4) {
if (cg) {
raxRemove(s->cgroups,(unsigned char*)grpname,sdslen(grpname),NULL);
streamFreeCG(cg);
addReply(c,shared.cone);
} else {
addReply(c,shared.czero);
}
} else if (!strcasecmp(opt,"DELCONSUMER") && c->argc == 5) { } else if (!strcasecmp(opt,"DELCONSUMER") && c->argc == 5) {
/* Delete the consumer and returns the number of pending messages /* Delete the consumer and returns the number of pending messages
* that were yet associated with such a consumer. */ * that were yet associated with such a consumer. */