MCPcopy Index your code
hub / github.com/labstack/echo / sleepWithContext

Function sleepWithContext

middleware/context_timeout_test.go:216–229  ·  view source on GitHub ↗
(ctx context.Context, d time.Duration)

Source from the content-addressed store, hash-verified

214}
215
216func sleepWithContext(ctx context.Context, d time.Duration) error {
217 timer := time.NewTimer(d)
218
219 defer func() {
220 _ = timer.Stop()
221 }()
222
223 select {
224 case <-ctx.Done():
225 return context.DeadlineExceeded
226 case <-timer.C:
227 return nil
228 }
229}

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…