()
| 156 | } |
| 157 | |
| 158 | func (p *Pool) reportQueueLength() { |
| 159 | ticker := time.NewTicker(queueLengthReportDuration) |
| 160 | go func() { |
| 161 | defer ticker.Stop() |
| 162 | for { |
| 163 | select { |
| 164 | case <-ticker.C: |
| 165 | metricQueryQueueLength.Set(float64(p.size.Load())) |
| 166 | case <-p.shutdownCh: |
| 167 | return |
| 168 | } |
| 169 | } |
| 170 | }() |
| 171 | } |
| 172 | |
| 173 | func runJob(job *job) { |
| 174 | defer job.wg.Done() |