]> git.saurik.com Git - redis.git/blobdiff - src/t_hash.c
Optimize LRANGE to scan the list starting from the head or the tail in order to trave...
[redis.git] / src / t_hash.c
index 4b9b37d69fed10b3c3586583dc0b38997647e887..83ca5b2754c3fce9d9e9bede7e1a1d95e90ba7f2 100644 (file)
@@ -403,8 +403,11 @@ void hdelCommand(redisClient *c) {
 
     for (j = 2; j < c->argc; j++) {
         if (hashTypeDelete(o,c->argv[j])) {
-            if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
             deleted++;
+            if (hashTypeLength(o) == 0) {
+                dbDelete(c->db,c->argv[1]);
+                break;
+            }
         }
     }
     if (deleted) {