178
return // task queue closing
179
}
180
>
if !softassert.That(tm.logger, res.task != nil, "expected a task from match") {
pri_matcher.go
181
continue
182
}
183
185
>
186
>
// backoff on resource exhausted errors
187
>
if common.IsResourceExhausted(err) {
188
util.InterruptibleSleep(tm.tqCtx, retrier.NextBackOff(err))
190
>
retrier.Reset()
191
>
}
192
}
193
}
194
195
>
func (tm *priTaskMatcher) forwardTask(task *internalTask) (bool, error) {
pri_matcher.go
196
>
var ctx context.Context
197
>
var cancel context.CancelFunc
198
>
if task.forwardCtx != nil {
199
>
// Use sync match context if we have it (for deadline, headers, etc.)
200
>
// TODO(pri): does it make sense to subtract 1s from the context deadline here?
201
>
// Also arrange for this to be canceled on tqCtx closing.
202
>
ctx, cancel = context.WithCancel(task.forwardCtx)
203
>
stop := context.AfterFunc(tm.tqCtx, cancel)
204
>
defer cancel()
205
>
defer stop()
206
>
} else {
207
// Task is from local backlog.
208