LATENCY HISTORY returns empty array if no data is available.

Previously we returned an error.
This commit is contained in:
antirez 2014-07-10 16:20:40 +02:00
parent 186b5b0f66
commit 49903897ef

View File

@ -524,8 +524,11 @@ void latencyCommand(redisClient *c) {
if (!strcasecmp(c->argv[1]->ptr,"history") && c->argc == 3) { if (!strcasecmp(c->argv[1]->ptr,"history") && c->argc == 3) {
/* LATENCY HISTORY <event> */ /* LATENCY HISTORY <event> */
ts = dictFetchValue(server.latency_events,c->argv[2]->ptr); ts = dictFetchValue(server.latency_events,c->argv[2]->ptr);
if (ts == NULL) goto nodataerr; if (ts == NULL) {
addReplyMultiBulkLen(c,0);
} else {
latencyCommandReplyWithSamples(c,ts); latencyCommandReplyWithSamples(c,ts);
}
} else if (!strcasecmp(c->argv[1]->ptr,"graph") && c->argc == 3) { } else if (!strcasecmp(c->argv[1]->ptr,"graph") && c->argc == 3) {
/* LATENCY GRAPH <event> */ /* LATENCY GRAPH <event> */
sds graph; sds graph;