From 7c6f1be5df4b3f453ab3928b2239ed60138e1cef Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 4 Jun 2018 12:58:26 +0200 Subject: [PATCH] XGROUP DESTROY implemented. --- src/t_stream.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/t_stream.c b/src/t_stream.c index 6cbef56c..1f904eff 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -1542,7 +1542,6 @@ NULL /* Certain subcommands require the group to exist. */ if ((cg = streamLookupCG(s,grpname)) == NULL && (!strcasecmp(opt,"SETID") || - !strcasecmp(opt,"DELGROUP") || !strcasecmp(opt,"DELCONSUMER"))) { addReplyErrorFormat(c, "-NOGROUP No such consumer group '%s' " @@ -1569,7 +1568,14 @@ NULL sdsnew("-BUSYGROUP Consumer Group name already exists\r\n")); } } 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) { /* Delete the consumer and returns the number of pending messages * that were yet associated with such a consumer. */