]> git.saurik.com Git - redis.git/commitdiff
Fixed issues with expire introduced with latest millisecond resolution feature. Many...
authorantirez <antirez@gmail.com>
Sat, 12 Nov 2011 00:04:27 +0000 (01:04 +0100)
committerantirez <antirez@gmail.com>
Sat, 12 Nov 2011 00:04:27 +0000 (01:04 +0100)
src/aof.c
src/debug.c
src/rdb.c
src/redis.c

index 8f3f5d59ea8b74571cd1692eb227a46812443844..4a463bde0664b34e39ceb5a9da9fe96bc485bdc5 100644 (file)
--- a/src/aof.c
+++ b/src/aof.c
@@ -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);
index 2dfe22806acf48095b3f29a3e66b2886a7b7fd92..376e07125df988bf1942813879635619f2877bb3 100644 (file)
@@ -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);
index e11f5c9c3f27f1809c0814aa52c27b8ac8198eba..2c0feb6ded874318b19226a14ea6026c58d705e5 100644 (file)
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -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;
 
index 7d2094390c8a37363faf845200836c32d20cca5a..23b7b280d8e8553d0806926b75a68c352e9e429b 100644 (file)
@@ -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));