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 e40fa4f commit 1793920
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ $breaker = CircuitBreaker::for('3rd-party-service')

Every circuit breaker has its own default config. You can always change it to fit your needs.
```php
$result = CircuitBreaker::for('3rd-party-service')
$breaker = CircuitBreaker::for('3rd-party-service')
->withOptions([
'failure_threshold' => 10,
'recovery_time' => 120
])->call(function () {
// Your function that could fail
});
]);
```

### Middlewares
Expand All @@ -65,8 +63,6 @@ You can set circuit breaker to fail even if function call didn't throw an except
$breaker = CircuitBreaker::for('test-service')
->failWhen(function ($result) {
return $result->status() >= 400;
})->call(function () {
// Your function that could fail
});
```

Expand All @@ -76,8 +72,6 @@ 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 1793920

Please sign in to comment.