MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / SleeperFuncCtx

Function SleeperFuncCtx

base/util.go:523–530  ·  view source on GitHub ↗

SleeperFuncCtx wraps the given RetrySleeper with a context, so it can be cancelled, or have a deadline.

(sleeperFunc RetrySleeper, ctx context.Context)

Source from the content-addressed store, hash-verified

521
522// SleeperFuncCtx wraps the given RetrySleeper with a context, so it can be cancelled, or have a deadline.
523func SleeperFuncCtx(sleeperFunc RetrySleeper, ctx context.Context) RetrySleeper {
524 return func(retryCount int) (bool, int) {
525 if err := ctx.Err(); err != nil {
526 return false, -1
527 }
528 return sleeperFunc(retryCount)
529 }
530}
531
532// Create a RetrySleeper that will double the retry time on every iteration and
533// use the given parameters.

Callers 4

reconnectMethod · 0.92
waitForProcessedTotalMethod · 0.92
waitForSequenceMethod · 0.92

Calls 1

ErrMethod · 0.80

Tested by 1

waitForProcessedTotalMethod · 0.74