failsafe-lib / failsafe

Fault tolerance and resilience patterns for the JVM
https://failsafe.dev
Apache License 2.0
4.2k stars 297 forks source link

preexecute + standalone circuit breaker #249

Closed gokelly closed 3 years ago

gokelly commented 4 years ago

Hi, What purpose does preexecute serve? Testing circuit breaker in standalone mode the circuit seems to be opened and closed when expected without making any calls to preexecute (or recordSuccess).

jhalterman commented 4 years ago

When in a half-open state we don't want to allow too many concurrent executions. So we limit the circuit breaker to only allow as many executions as are configured in the success or failure threshold. Calling preExecute helps the CircuitBreaker track how many executions are in progress.

jhalterman commented 3 years ago

Closing for now. Please reopen if needed for further discussion.