0 purchases
circuit breaker
Circuit Breaker #
Using #
Create #
final http = Client();
final Request request = Request('POST', Uri.parse('http://example.com'));
final cb = CircuitBreaker(
request: request,
failureThreshold: 3,
successThreshold: 5,
timeout: Duration(seconds: 2));
copied to clipboard
Results #
await cb.execute()
.then((value){
print("Success breaker");
}).catchError((error, stack){
print("Fail breaker");
});
copied to clipboard
OR
// 2
final result = await cb.execute();
print(result.statusCode);
print(result.body);
print(result.state);
print(result.nextAttempt);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.