]> git.saurik.com Git - redis.git/blobdiff - dict.c
dictGetRandomKey bug fixed, RANDOMKEY will not block the server anymore
[redis.git] / dict.c
diff --git a/dict.c b/dict.c
index 4e740e7d2013ef9deb644e46e53af0a966c23f1b..9360d52ebeac482cae8f1d092fa3273fc22d525f 100644 (file)
--- a/dict.c
+++ b/dict.c
@@ -377,7 +377,7 @@ dictEntry *dictGetRandomKey(dict *ht)
     unsigned int h;
     int listlen, listele;
 
-    if (ht->size == 0) return NULL;
+    if (ht->used == 0) return NULL;
     do {
         h = random() & ht->sizemask;
         he = ht->table[h];