You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ RETRY
8
8
</h1>
9
9
10
10
<palign="center">
11
-
RETRY is a flexible and configurable retry mechanism for Go. With RETRY, you can easily implement retry logic with customizable backoff strategies to enhance the resilience of your applications.
11
+
Flexible and configurable retry mechanism for Go. With RETRY, you can easily implement retry logic with customizable backoff strategies to enhance the resilience of your applications.
12
12
</p>
13
13
14
14
<palign="center">
@@ -52,16 +52,16 @@ import (
52
52
)
53
53
54
54
funcmain() {
55
-
retry:= retry.New(
56
-
Config{
55
+
r:= retry.New(
56
+
retry.Config{
57
57
maxAttemptTimes: 10,
58
58
})
59
59
60
60
fn:=func() error {
61
61
return errors.New("temporary error")
62
62
}
63
63
ctx:= context.Background()
64
-
iferr:=retry.Do(ctx, fn); err != nil {
64
+
iferr:=r.Do(ctx, fn); err != nil {
65
65
if retry.IsMaxRetriesError(err) {
66
66
fmt.Println("Failed after maximum number of retries")
67
67
} else {
@@ -89,20 +89,20 @@ import (
89
89
)
90
90
91
91
funcmain() {
92
-
retry:= retry.New(
93
-
Config{
94
-
maxAttemptTimes: 5,
95
-
initialBackoff: 100 * time.Millisecond,
96
-
maxBackoff: 1 * time.Second,
97
-
maxJitter: 50 * time.Millisecond,
92
+
r:= retry.New(
93
+
retry.Config{
94
+
MaxAttemptTimes: 5,
95
+
InitialBackoff: 100 * time.Millisecond,
96
+
MaxBackoff: 1 * time.Second,
97
+
MaxJitter: 50 * time.Millisecond,
98
98
})
99
99
100
100
fn:=func() error {
101
101
return errors.New("temporary error")
102
102
}
103
103
104
104
ctx:= context.Background()
105
-
iferr:=retry.Do(ctx, fn); err != nil {
105
+
iferr:=r.Do(ctx, fn); err != nil {
106
106
if retry.IsMaxRetriesError(err) {
107
107
fmt.Println("Failed after maximum number of retries")
0 commit comments