@@ -2344,7 +2344,7 @@ Invokes a function N times until it returns valid output. Returning either the c
2344
2344
When first argument is less than ` 1 ` , the function runs until a successful response is returned.
2345
2345
2346
2346
``` go
2347
- count1 , err1 := AttemptWhile (5 , func (i int ) (error , bool ) {
2347
+ count1 , err1 := lo. AttemptWhile (5 , func (i int ) (error , bool ) {
2348
2348
err := doMockedHTTPRequest (i)
2349
2349
if err != nil {
2350
2350
if errors.Is (err, ErrBadRequest) { // lets assume ErrBadRequest is a critical error that needs to terminate the invoke
@@ -2360,7 +2360,7 @@ count1, err1 := AttemptWhile(5, func(i int) (error, bool) {
2360
2360
2361
2361
For more advanced retry strategies (delay, exponential backoff...), please take a look on [ cenkalti/backoff] ( https://github.com/cenkalti/backoff ) .
2362
2362
2363
- [ play] ( https://go.dev/play/p/M2wVq24PaZM )
2363
+ [[ play] ( https://go.dev/play/p/M2wVq24PaZM )]
2364
2364
2365
2365
### AttemptWhileWithDelay
2366
2366
@@ -2369,7 +2369,7 @@ Invokes a function N times until it returns valid output, with a pause between e
2369
2369
When first argument is less than ` 1 ` , the function runs until a successful response is returned.
2370
2370
2371
2371
``` go
2372
- count1 , time1 , err1 := AttemptWhileWithDelay (5 , time.Millisecond , func (i int , d time.Duration ) (error , bool ) {
2372
+ count1 , time1 , err1 := lo. AttemptWhileWithDelay (5 , time.Millisecond , func (i int , d time.Duration ) (error , bool ) {
2373
2373
err := doMockedHTTPRequest (i)
2374
2374
if err != nil {
2375
2375
if errors.Is (err, ErrBadRequest) { // lets assume ErrBadRequest is a critical error that needs to terminate the invoke
@@ -2385,7 +2385,7 @@ count1, time1, err1 := AttemptWhileWithDelay(5, time.Millisecond, func(i int, d
2385
2385
2386
2386
For more advanced retry strategies (delay, exponential backoff...), please take a look on [ cenkalti/backoff] ( https://github.com/cenkalti/backoff ) .
2387
2387
2388
- [ play] ( https://go.dev/play/p/LPsWgf1ilBO )
2388
+ [[ play] ( https://go.dev/play/p/cfcmhvLO-nv )]
2389
2389
2390
2390
### Debounce
2391
2391
0 commit comments