From 37b35e31922b37a678c1299751bf2d823633c776 Mon Sep 17 00:00:00 2001 From: Rahul Baruri Date: Mon, 16 Oct 2023 01:04:20 +0200 Subject: [PATCH] Resolved github actions and updated readme --- .github/{workflow => workflows}/go.yaml | 0 README.md | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) rename .github/{workflow => workflows}/go.yaml (100%) diff --git a/.github/workflow/go.yaml b/.github/workflows/go.yaml similarity index 100% rename from .github/workflow/go.yaml rename to .github/workflows/go.yaml diff --git a/README.md b/README.md index 0861801..b787d01 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,25 @@ if err == retry.ErrDeadlineExceeded { } ``` -### Retry failed operations with a maximum 10 retries and with an Custom Backoff function. +``` + +### Retry failed operations with a deadline of 1 minute and with ExponentialBackoff. Every retry the delay will be twice compared to the previous delay. But the maximum delay will be 10 seconds. + +```go +err := retry.Retry(func() bool { + err := doesHeavyLifting() + if err != nil { + return true // retry operation + } + return false // No need to retry + }, 1 * time.Minute(), retry.ExponentialBackoff(10)) + +if err == retry.ErrDeadlineExceeded { + fmt.Error("Retry deadline exceeded") +} + +``` +### Retry failed operations with a maximum 10 retries and with an Custom Backoff function. Delay will be 1.5 times compared to the previous delay. ```go err := retry.Retry(func() bool {