410
func (tm *TaskMatcher) poll(
411
ctx context.Context, pollMetadata *pollMetadata, queryOnly bool,
412
>
) (task *internalTask, forwardedPoll bool, err error) {
matcher.go
413
>
taskC, queryTaskC := tm.taskC, tm.queryTaskC
414
>
if queryOnly {
415
taskC = nil
416
}
417
419
>
tm.lastPoller.Store(start.UnixNano())
420
>
421
>
defer func() {
422
>
if pollMetadata.forwardedFrom == "" {
423
>
// Only recording for original polls
424
>
var pollResult string
425
>
if err == nil {
426
pollResult = "success"
427
>
} else if errors.Is(err, errNoTasks) {
matcher.go
428
pollResult = "timeout"
429
} else {
430
pollResult = "failed"
431
}
432
>
metrics.PollLatencyPerTaskQueue.With(tm.metricsHandler).Record(
matcher.go
433
>
time.Since(start),
434
>
metrics.ForwardedTag(forwardedPoll),
435
>
metrics.StringTag(metrics.TaskPriorityTagName, ""),
436
>
metrics.PollResultTag(pollResult),
437
>
)
438
}
439
441
tm.emitForwardedSourceStats(task.isForwarded(), pollMetadata.forwardedFrom, forwardedPoll)
442
}