From f2c081058c1c18e8659a59b27bdeabfd9f2f39c6 Mon Sep 17 00:00:00 2001 From: Leo Antunes Date: Thu, 25 Jan 2024 09:41:38 +0100 Subject: [PATCH] fix(docs): use duration as sliding window argument --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92671ba..8c17636 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ h, err := hoglet.NewCircuit( } return Foo{}, fmt.Errorf("bar is not 42") }, - hoglet.NewSlidingWindowBreaker(10, 0.1), + hoglet.NewSlidingWindowBreaker(5*time.Second, 0.1), hoglet.WithFailureCondition(hoglet.IgnoreContextCanceled), ) /* if err != nil ... */ @@ -29,6 +29,11 @@ fmt.Println(err) // bar is not 42 _, err = h.Call(context.Background(), 42) fmt.Println(err) // hoglet: breaker is open + +time.Sleep(5 * time.Second) + +f, _ = h.Call(context.Background(), 42) +fmt.Println(f.Bar) // 42 ``` ## Operation