Skip to content

Commit

Permalink
fix(docs): use duration as sliding window argument
Browse files Browse the repository at this point in the history
  • Loading branch information
costela committed Jan 28, 2024
1 parent e31cdf5 commit f2c0810
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ... */
Expand All @@ -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
Expand Down

0 comments on commit f2c0810

Please sign in to comment.