MCPcopy Create free account
hub / github.com/cortexproject/cortex / Send

Method Send

pkg/ingester/client/client_test.go:268–289  ·  view source on GitHub ↗
(req *cortexpb.StreamWriteRequest)

Source from the content-addressed store, hash-verified

266}
267
268func (s *slowSendStream) Send(req *cortexpb.StreamWriteRequest) (retErr error) {
269 defer func() {
270 if r := recover(); r != nil {
271 s.panicCh <- r // forward the panic value to the test
272 } else {
273 s.panicCh <- nil
274 }
275 }()
276
277 // gRPC codec pre-computes buffer size.
278 size := req.Size()
279 buf := make([]byte, size)
280
281 // Sleep so the caller's ctx deadline fires and PushStreamConnection returns.
282 // After the sleep the caller may have grown the timeseries.
283 time.Sleep(s.sendDelay)
284
285 // marshal into the pre-allocated buffer.
286 // Panics when actual data > size (the bug).
287 _, err := req.MarshalToSizedBuffer(buf)
288 return err
289}
290
291func (s *slowSendStream) Recv() (*cortexpb.WriteResponse, error) {
292 return &cortexpb.WriteResponse{}, nil

Callers

nothing calls this directly

Calls 2

SizeMethod · 0.65
MarshalToSizedBufferMethod · 0.65

Tested by

no test coverage detected