From 040c64f0d533c3a3f951a90f5316b0de9cb1ce14 Mon Sep 17 00:00:00 2001 From: EquentR <62492107+EquentR@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:12:52 +0800 Subject: [PATCH] fix: switchdb blocking after closing destination reply (#837) https://github.com/tair-opensource/RedisShake/issues/836 --- internal/writer/redis_standalone_writer.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/writer/redis_standalone_writer.go b/internal/writer/redis_standalone_writer.go index 392a8ff3..13049adc 100644 --- a/internal/writer/redis_standalone_writer.go +++ b/internal/writer/redis_standalone_writer.go @@ -92,9 +92,11 @@ func (w *redisStandaloneWriter) switchDbTo(newDbId int) { log.Debugf("[%s] switch db to [%d]", w.stat.Name, newDbId) w.client.Send("select", strconv.Itoa(newDbId)) w.DbId = newDbId - w.chWaitReply <- &entry.Entry{ - Argv: []string{"select", strconv.Itoa(newDbId)}, - CmdName: "select", + if !w.offReply { + w.chWaitReply <- &entry.Entry{ + Argv: []string{"select", strconv.Itoa(newDbId)}, + CmdName: "select", + } } }