Commit 6d5790d6 authored by antirez's avatar antirez
Browse files

Fix OBJECT IDLETIME return value converting to seconds.

estimateObjectIdleTime() returns a value in milliseconds now, so we need
to scale the output of OBJECT IDLETIME to seconds.
parent ad6b0f70
...@@ -648,7 +648,7 @@ char *strEncoding(int encoding) { ...@@ -648,7 +648,7 @@ char *strEncoding(int encoding) {
} }
} }
/* Given an object returns the min number of seconds the object was never /* Given an object returns the min number of milliseconds the object was never
* requested, using an approximated LRU algorithm. */ * requested, using an approximated LRU algorithm. */
unsigned long long estimateObjectIdleTime(robj *o) { unsigned long long estimateObjectIdleTime(robj *o) {
unsigned long long lruclock = LRU_CLOCK(); unsigned long long lruclock = LRU_CLOCK();
...@@ -692,7 +692,7 @@ void objectCommand(redisClient *c) { ...@@ -692,7 +692,7 @@ void objectCommand(redisClient *c) {
} else if (!strcasecmp(c->argv[1]->ptr,"idletime") && c->argc == 3) { } else if (!strcasecmp(c->argv[1]->ptr,"idletime") && c->argc == 3) {
if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk)) if ((o = objectCommandLookupOrReply(c,c->argv[2],shared.nullbulk))
== NULL) return; == NULL) return;
addReplyLongLong(c,estimateObjectIdleTime(o)); addReplyLongLong(c,estimateObjectIdleTime(o)/1000);
} else { } else {
addReplyError(c,"Syntax error. Try OBJECT (refcount|encoding|idletime)"); addReplyError(c,"Syntax error. Try OBJECT (refcount|encoding|idletime)");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment