| 58 | } |
| 59 | |
| 60 | func NewRequestQueue(maxOutstandingPerTenant int, queueLength *prometheus.GaugeVec, batchWeight *prometheus.HistogramVec, discardedRequests *prometheus.CounterVec) *RequestQueue { |
| 61 | q := &RequestQueue{ |
| 62 | queues: newUserQueues(maxOutstandingPerTenant), |
| 63 | queueLength: queueLength, |
| 64 | batchWeight: batchWeight, |
| 65 | discardedRequests: discardedRequests, |
| 66 | } |
| 67 | |
| 68 | q.cond = contextCond{Cond: sync.NewCond(&q.mtx)} |
| 69 | q.Service = services.NewTimerService(queueCleanupPeriod, nil, q.cleanupQueues, q.stopping).WithName("request queue") |
| 70 | |
| 71 | return q |
| 72 | } |
| 73 | |
| 74 | // EnqueueRequest puts the request into the queue. |
| 75 | // |