execStateFromCtx returns the per-request ExecState attached to the context, or nil when the cache layer is being driven outside a request lifecycle (e.g. background prefetch). Cache-scope counter increments are no-ops in that case.
(ctx context.Context)
| 97 | // request lifecycle (e.g. background prefetch). Cache-scope counter |
| 98 | // increments are no-ops in that case. |
| 99 | func execStateFromCtx(ctx context.Context) *common.ExecState { |
| 100 | r := ctx.Value(common.RequestContextKey) |
| 101 | if r == nil { |
| 102 | return nil |
| 103 | } |
| 104 | req, ok := r.(*common.NormalizedRequest) |
| 105 | if !ok || req == nil { |
| 106 | return nil |
| 107 | } |
| 108 | return req.ExecState() |
| 109 | } |
| 110 | |
| 111 | func (e *cacheExecutor) runRetry( |
| 112 | ctx context.Context, |
no test coverage detected