From 391da8803e9c23a470bd33dadc68d99ba197ab3d Mon Sep 17 00:00:00 2001 From: lucas Date: Tue, 24 Sep 2024 09:00:48 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=88=87=E7=89=87=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=BC=95=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- et_sink/sinkHandler.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/et_sink/sinkHandler.go b/et_sink/sinkHandler.go index 94efc79..c5ed2dc 100644 --- a/et_sink/sinkHandler.go +++ b/et_sink/sinkHandler.go @@ -126,7 +126,9 @@ func (the *SinkHandler) dumpRawBatchMonitor() { if len(the.dataQueueRaw) > 0 { count := len(the.dataQueueRaw) log.Printf("es写入dataQueueRaw数据 count====> %d", count) - needDump := the.dataQueueRaw[:count] //make([]common_models.EsRaw, count) + needDump := make([]common_models.EsRaw, count) + //避免引用问题 + copy(needDump, the.dataQueueRaw[:count]) the.dataQueueRaw = the.dataQueueRaw[count:] go the.dumpRaws(needDump) } @@ -164,7 +166,9 @@ func (the *SinkHandler) dumpThemeBatchMonitor() { } if len(the.dataQueueTheme) > 0 { count := len(the.dataQueueTheme) - needDump := the.dataQueueTheme[:count] + needDump := make([]common_models.EsTheme, count) + //避免引用问题 + copy(needDump, the.dataQueueTheme[:count]) the.dataQueueTheme = the.dataQueueTheme[count:] go the.dumpThemes(needDump) }