Skip to content

Commit

Permalink
Change readme
Browse files Browse the repository at this point in the history
  • Loading branch information
stfndamjanovic committed Jan 18, 2024
1 parent e730a8c commit e40fa4f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ $result = CircuitBreaker::for('3rd-party-service')
->withOptions([
'failure_threshold' => 10,
'recovery_time' => 120
])
->call(function () {
])->call(function () {
// Your function that could fail
});
```
Expand All @@ -65,7 +64,9 @@ You can set circuit breaker to fail even if function call didn't throw an except
```php
$breaker = CircuitBreaker::for('test-service')
->failWhen(function ($result) {
return $result->status() > 400;
return $result->status() >= 400;
})->call(function () {
// Your function that could fail
});
```

Expand All @@ -75,6 +76,8 @@ Or you want to avoid some type of failures.
$breaker = CircuitBreaker::for('test-service')
->skipFailure(function ($exception) {
return $exception instanceof HttpException;
})->call(function () {
// Your function that could fail
});
```

Expand Down

0 comments on commit e40fa4f

Please sign in to comment.