Skip to content

Commit 5d74a8f

Browse files
committed
Add it to hdel as well
Signed-off-by: Binbin <binloveplay1314@qq.com>
1 parent c21690b commit 5d74a8f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/t_hash.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,7 @@ void hdelCommand(client *c) {
11271127
if ((o = lookupKeyWriteOrReply(c, c->argv[1], shared.czero)) == NULL || checkType(c, o, OBJ_HASH)) return;
11281128

11291129
bool hash_volatile_items = hashTypeHasVolatileFields(o);
1130+
if (o->encoding == OBJ_ENCODING_HASHTABLE) hashtablePauseAutoShrink(objectGetVal(o));
11301131
for (j = 2; j < c->argc; j++) {
11311132
if (hashTypeDelete(o, objectGetVal(c->argv[j]))) {
11321133
deleted++;
@@ -1138,6 +1139,7 @@ void hdelCommand(client *c) {
11381139
}
11391140
}
11401141
}
1142+
if (!keyremoved && o->encoding == OBJ_ENCODING_HASHTABLE) hashtableResumeAutoShrink(objectGetVal(o));
11411143
if (deleted) {
11421144
if (!keyremoved && hash_volatile_items != hashTypeHasVolatileFields(o)) {
11431145
dbUpdateObjectWithVolatileItemsTracking(c->db, o);

0 commit comments

Comments
 (0)