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) }