diff --git a/src/db.c b/src/db.c index a1f476e697..8bbc20c343 100644 --- a/src/db.c +++ b/src/db.c @@ -1975,7 +1975,7 @@ void moveCommand(client *c) { dbAddByLink(dst, c->argv[1], &kv, &dstBucket); if (expire != -1) - setExpireByLink(c, dst, c->argv[1]->ptr, expire, dstBucket); + kv = setExpireByLink(c, dst, c->argv[1]->ptr, expire, dstBucket); /* If object of type hash with expiration on fields. Taken care to add the * hash to hexpires of `dst` only after dbDelete(). */ diff --git a/tests/unit/type/hash-field-expire.tcl b/tests/unit/type/hash-field-expire.tcl index a94a6b303f..99404a1ca1 100644 --- a/tests/unit/type/hash-field-expire.tcl +++ b/tests/unit/type/hash-field-expire.tcl @@ -616,6 +616,7 @@ start_server {tags {"external:skip needs:debug"}} { r select 9 r flushall r hset myhash field1 value1 + r expireat myhash 2000000000000 ;# Force kvobj reallocation during move command r hpexpire myhash 100 NX FIELDS 1 field1 r move myhash 10 assert_equal [r exists myhash] 0