diff --git a/lib/protoparser/csvimport/streamparser.go b/lib/protoparser/csvimport/streamparser.go index cd0bd0314..247526b8b 100644 --- a/lib/protoparser/csvimport/streamparser.go +++ b/lib/protoparser/csvimport/streamparser.go @@ -48,7 +48,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error { uw := getUnmarshalWork() uw.callback = callback uw.cds = cds - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...) + uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf common.ScheduleUnmarshalWork(uw) } return ctx.Error() diff --git a/lib/protoparser/graphite/streamparser.go b/lib/protoparser/graphite/streamparser.go index f553d529a..2eea19bd5 100644 --- a/lib/protoparser/graphite/streamparser.go +++ b/lib/protoparser/graphite/streamparser.go @@ -33,7 +33,7 @@ func ParseStream(r io.Reader, callback func(rows []Row) error) error { for ctx.Read() { uw := getUnmarshalWork() uw.callback = callback - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...) + uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf common.ScheduleUnmarshalWork(uw) } return ctx.Error() diff --git a/lib/protoparser/influx/streamparser.go b/lib/protoparser/influx/streamparser.go index bf4d6f552..5b0fd3287 100644 --- a/lib/protoparser/influx/streamparser.go +++ b/lib/protoparser/influx/streamparser.go @@ -59,7 +59,7 @@ func ParseStream(r io.Reader, isGzipped bool, precision, db string, callback fun uw.callback = callback uw.db = db uw.tsMultiplier = tsMultiplier - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...) + uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf common.ScheduleUnmarshalWork(uw) } return ctx.Error() diff --git a/lib/protoparser/opentsdb/streamparser.go b/lib/protoparser/opentsdb/streamparser.go index bc9507f74..cf2b4f89e 100644 --- a/lib/protoparser/opentsdb/streamparser.go +++ b/lib/protoparser/opentsdb/streamparser.go @@ -32,7 +32,7 @@ func ParseStream(r io.Reader, callback func(rows []Row) error) error { for ctx.Read() { uw := getUnmarshalWork() uw.callback = callback - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...) + uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf common.ScheduleUnmarshalWork(uw) } return ctx.Error() diff --git a/lib/protoparser/opentsdbhttp/streamparser.go b/lib/protoparser/opentsdbhttp/streamparser.go index bc8d9ca77..9a7ffaa5f 100644 --- a/lib/protoparser/opentsdbhttp/streamparser.go +++ b/lib/protoparser/opentsdbhttp/streamparser.go @@ -59,7 +59,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error { uw := getUnmarshalWork() uw.callback = callback - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf.B...) + uw.reqBuf, ctx.reqBuf.B = ctx.reqBuf.B, uw.reqBuf common.ScheduleUnmarshalWork(uw) return nil } diff --git a/lib/protoparser/prometheus/streamparser.go b/lib/protoparser/prometheus/streamparser.go index 061a7dc36..cfee948cb 100644 --- a/lib/protoparser/prometheus/streamparser.go +++ b/lib/protoparser/prometheus/streamparser.go @@ -34,7 +34,7 @@ func ParseStream(r io.Reader, defaultTimestamp int64, isGzipped bool, callback f uw := getUnmarshalWork() uw.callback = callback uw.defaultTimestamp = defaultTimestamp - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...) + uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf common.ScheduleUnmarshalWork(uw) } return ctx.Error() diff --git a/lib/protoparser/promremotewrite/streamparser.go b/lib/protoparser/promremotewrite/streamparser.go index a6c88b58a..4312310d6 100644 --- a/lib/protoparser/promremotewrite/streamparser.go +++ b/lib/protoparser/promremotewrite/streamparser.go @@ -30,7 +30,7 @@ func ParseStream(req *http.Request, callback func(tss []prompb.TimeSeries) error } uw := getUnmarshalWork() uw.callback = callback - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf.B...) + uw.reqBuf, ctx.reqBuf.B = ctx.reqBuf.B, uw.reqBuf common.ScheduleUnmarshalWork(uw) return nil } diff --git a/lib/protoparser/vmimport/streamparser.go b/lib/protoparser/vmimport/streamparser.go index f0eefdfe4..915ac18e8 100644 --- a/lib/protoparser/vmimport/streamparser.go +++ b/lib/protoparser/vmimport/streamparser.go @@ -39,7 +39,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error { for ctx.Read() { uw := getUnmarshalWork() uw.callback = callback - uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...) + uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf common.ScheduleUnmarshalWork(uw) } return ctx.Error()