From 3ded3b83fbdee06e65264f3fab79f2d1d0684284 Mon Sep 17 00:00:00 2001 From: EquentR <62492107+EquentR@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:39:48 +0800 Subject: [PATCH] fix: switchdb blocking after closing destination reply 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", + } } }