From 37cd2412f2b710daefab1fa9ff47739f47053161 Mon Sep 17 00:00:00 2001 From: zhuhuikang Date: Sat, 21 Mar 2020 11:12:15 +0800 Subject: [PATCH] feat(*):ignore sentinel channel --- src/redis-shake/sync.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/redis-shake/sync.go b/src/redis-shake/sync.go index 2bb85e6..9b47319 100644 --- a/src/redis-shake/sync.go +++ b/src/redis-shake/sync.go @@ -591,6 +591,7 @@ func (ds *dbSyncer) syncCommand(reader *bufio.Reader, target []string, auth_type log.Infof("dbSyncer[%v] FlushEvent:IncrSyncStart\tId:%s\t", ds.id, conf.Options.Id) for { + ignoresentinel:= false ignorecmd := false isselect = false resp := redis.MustDecodeOpt(decoder) @@ -625,7 +626,10 @@ func (ds *dbSyncer) syncCommand(reader *bufio.Reader, target []string, auth_type } else if filter.FilterCommands(scmd) { ignorecmd = true } - if bypass || ignorecmd { + if strings.EqualFold(scmd, "publish") && strings.EqualFold(string(argv[0]), "__sentinel__:hello"){ + ignoresentinel = true + } + if bypass || ignorecmd || ignoresentinel{ ds.nbypass.Incr() // ds.SyncStat.BypassCmdCount.Incr() metric.GetMetric(ds.id).AddBypassCmdCount(ds.id, 1)