From 2a32f0371edeb818a45a0648b2b13bffe93e558b Mon Sep 17 00:00:00 2001
From: Jan-Erik Rediger <janerik@fnordig.de>
Date: Thu, 8 Dec 2016 14:27:21 +0100
Subject: [PATCH] Reset the ttl for additional keys

Before, if a previous key had a TTL set but the current one didn't, the
TTL was reused and thus resulted in wrong expirations set.

This behaviour was experienced, when `MigrateDefaultPipeline` in
redis-trib was set to >1

Fixes #3655
---
 src/cluster.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cluster.c b/src/cluster.c
index bedf5f81..4f3b38e9 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -4841,6 +4841,7 @@ try_again:
 
     /* Create RESTORE payload and generate the protocol to call the command. */
     for (j = 0; j < num_keys; j++) {
+        ttl = 0;
         expireat = getExpire(c->db,kv[j]);
         if (expireat != -1) {
             ttl = expireat-mstime();