提交 4be855e7 编写于 作者: A antirez

Fixed issues with expire introduced with latest millisecond resolution...

Fixed issues with expire introduced with latest millisecond resolution feature. Many time_t were not converted to long long, and one time() call was not replaced with mstime().
上级 3570629f
......@@ -431,7 +431,7 @@ int rewriteAppendOnlyFile(char *filename) {
FILE *fp;
char tmpfile[256];
int j;
time_t now = time(NULL);
long long now = mstime();
/* Note that we have to use a different temp name here compared to the
* one used by rewriteAppendOnlyFileBackground() function. */
......@@ -462,7 +462,7 @@ int rewriteAppendOnlyFile(char *filename) {
while((de = dictNext(di)) != NULL) {
sds keystr;
robj key, *o;
time_t expiretime;
long long expiretime;
keystr = dictGetKey(de);
o = dictGetVal(de);
......
......@@ -91,7 +91,7 @@ void computeDatasetDigest(unsigned char *final) {
while((de = dictNext(di)) != NULL) {
sds key;
robj *keyobj, *o;
time_t expiretime;
long long expiretime;
memset(digest,0,20); /* This key-val digest */
key = dictGetKey(de);
......
......@@ -597,7 +597,7 @@ int rdbSave(char *filename) {
dictEntry *de;
char tmpfile[256];
int j;
time_t now = mstime();
long long now = mstime();
FILE *fp;
rio rdb;
......
......@@ -562,17 +562,17 @@ void activeExpireCycle(void) {
* of the keys were expired. */
do {
long num = dictSize(db->expires);
time_t now = time(NULL);
long long now = mstime();
expired = 0;
if (num > REDIS_EXPIRELOOKUPS_PER_CRON)
num = REDIS_EXPIRELOOKUPS_PER_CRON;
while (num--) {
dictEntry *de;
time_t t;
long long t;
if ((de = dictGetRandomKey(db->expires)) == NULL) break;
t = (time_t) dictGetVal(de);
t = dictGetSignedIntegerVal(de);
if (now > t) {
sds key = dictGetKey(de);
robj *keyobj = createStringObject(key,sdslen(key));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册