RequestDuration returns the duration since the timer started in the context.
(ctx context.Context)
| 21 | |
| 22 | // RequestDuration returns the duration since the timer started in the context. |
| 23 | func RequestDuration(ctx context.Context) time.Duration { |
| 24 | if t, ok := ctx.Value(timerSinceCtxKey{}).(time.Time); ok { |
| 25 | return time.Since(t) |
| 26 | } |
| 27 | return 0 |
| 28 | } |
| 29 | |
| 30 | // CheckTimeout checks if the request context has timed out or cancelled and returns |
| 31 | // wrapped error. |
no outgoing calls
no test coverage detected