connor4312 / cockatiel

🐦 A resilience and fault-handling library. Supports Backoffs, Retries, Circuit Breakers, Timeouts, Bulkhead Isolation, and Fallbacks.
MIT License
1.59k stars 50 forks source link

provide access to wrapped policies #61

Closed xenoterracide closed 2 years ago

xenoterracide commented 2 years ago

it looks like this is a closure, but it would be nice to have a way to get access to the policies on a wrapped policy. This however also seems naughty... my reasoning though is that I would like to check in unit tests that a new retry is being returned by my method that creates the policy in the first place, and that the other policies are singletons. I'd be ok with it requiring you to poke the internals a little by accessing it via an object key. I also understand if you can't/don't want to do this.

connor4312 commented 2 years ago

I think this is a good idea -- also useful for introspection/telemetry if a policy is passed down to a nested consumer