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

Function WaitForConditionWithOptions

rest/utilities_testing.go:933–948  ·  view source on GitHub ↗
(ctx context.Context, successFunc func() bool, maxNumAttempts, timeToSleepMs int)

Source from the content-addressed store, hash-verified

931}
932
933func WaitForConditionWithOptions(ctx context.Context, successFunc func() bool, maxNumAttempts, timeToSleepMs int) error {
934 waitForSuccess := func() (shouldRetry bool, err error, value interface{}) {
935 if successFunc() {
936 return false, nil, nil
937 }
938 return true, nil, nil
939 }
940
941 sleeper := base.CreateSleeperFunc(maxNumAttempts, timeToSleepMs)
942 err, _ := base.RetryLoop(ctx, "Wait for condition options", waitForSuccess, sleeper)
943 if err != nil {
944 return err
945 }
946
947 return nil
948}
949
950func (rt *RestTester) WaitForConditionShouldRetry(conditionFunc func() (shouldRetry bool, err error, value interface{}), maxNumAttempts, timeToSleepMs int) error {
951 sleeper := base.CreateSleeperFunc(maxNumAttempts, timeToSleepMs)

Calls 2

CreateSleeperFuncFunction · 0.92
RetryLoopFunction · 0.92

Tested by 1