(batchSize, capacity int)
| 1422 | ) |
| 1423 | |
| 1424 | func newQueue(batchSize, capacity int) *queue { |
| 1425 | batches := capacity / batchSize |
| 1426 | // Always create an unbuffered channel even if capacity is configured to be |
| 1427 | // less than max_samples_per_send. |
| 1428 | if batches == 0 { |
| 1429 | batches = 1 |
| 1430 | } |
| 1431 | return &queue{ |
| 1432 | batch: make([]timeSeries, 0, batchSize), |
| 1433 | batchQueue: make(chan []timeSeries, batches), |
| 1434 | // batchPool should have capacity for everything in the channel + 1 for |
| 1435 | // the batch being processed. |
| 1436 | batchPool: make([][]timeSeries, 0, batches+1), |
| 1437 | } |
| 1438 | } |
| 1439 | |
| 1440 | // Append the timeSeries to the buffered batch. Returns false if it |
| 1441 | // cannot be added and must be retried. |
no outgoing calls
searching dependent graphs…