sunng87 / diehard

Clojure resilience library for flexible retry, circuit breaker and rate limiter
Eclipse Public License 2.0
331 stars 27 forks source link

Reuse RetryPolicy instead of recreating it everytime #5

Closed sunng87 closed 8 years ago

sunng87 commented 8 years ago

The current retry block recreates RetryPolicy everytime when it's called. It's a waste of CPU.

sunng87 commented 8 years ago

Actually RetryPolicy contains state for each block, so it won't be possible to reuse across multiple block as of Failsafe 0.9.2.

But we can define the clojure API as {:policy ...} and actually use policy.copy() internally at the moment.