diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2014-12-23 10:58:43 +0100 |
---|---|---|
committer | Salvatore Sanfilippo <antirez@gmail.com> | 2014-12-23 10:58:43 +0100 |
commit | 3a1ee895fad8798666d609a1dd327671327d73c6 (patch) | |
tree | c5aa67818cf2ef64ba68606203baa51415086f30 | |
parent | 5888290d260cd60aedcd695c8625eadb6f2c349e (diff) | |
parent | 32bba43ac7f9abd4efd7f79fc1ae6106656b9d8c (diff) | |
download | redis-3a1ee895fad8798666d609a1dd327671327d73c6.tar.gz |
Merge pull request #2234 from mattsta/feature/sentinel-info-cache/age
Add 'age' value to SENTINEL INFO-CACHE
-rw-r--r-- | src/sentinel.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index f252442a4..01c811813 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2784,6 +2784,7 @@ void sentinelCommand(redisClient *c) { sentinelSetCommand(c); } else if (!strcasecmp(c->argv[1]->ptr,"info-cache")) { if (c->argc < 2) goto numargserr; + mstime_t now = mstime(); /* Create an ad-hoc dictionary type so that we can iterate * a dictionary composed of just the master groups the user @@ -2819,6 +2820,8 @@ void sentinelCommand(redisClient *c) { sentinelRedisInstance *ri = dictGetVal(de); addReplyBulkCBuffer(c,ri->name,strlen(ri->name)); addReplyMultiBulkLen(c,dictSize(ri->slaves) + 1); /* +1 for self */ + addReplyMultiBulkLen(c,2); + addReplyLongLong(c, now - ri->info_refresh); if (ri->info) addReplyBulkCBuffer(c,ri->info,sdslen(ri->info)); else @@ -2829,6 +2832,8 @@ void sentinelCommand(redisClient *c) { sdi = dictGetIterator(ri->slaves); while ((sde = dictNext(sdi)) != NULL) { sentinelRedisInstance *sri = dictGetVal(sde); + addReplyMultiBulkLen(c,2); + addReplyLongLong(c, now - sri->info_refresh); if (sri->info) addReplyBulkCBuffer(c,sri->info,sdslen(sri->info)); else |