bolshakov / stoplight

:traffic_light: Traffic control for code.
http://bolshakov.github.io/stoplight/
MIT License
384 stars 40 forks source link

Adjustable cool_off_time proc #107

Closed zhuochun closed 8 years ago

zhuochun commented 8 years ago

My basic idea is accept cool_off_time as a proc

-> (times) { return times * 30 }

where times is the number of cycles of the circuit has been in RED. E.g. first circuit open, times = 1, after cool_off_time, test and remain RED, get cool_off_time with times = 2, etc.

Any suggestions, and places to start if I want to add this? Thanks.

tfausak commented 8 years ago

This would be a nice way to implement exponential backoff or something similar. However it would require storing information about attempted runs while the light is red. Doing that would also allow you to set the threshold in terms of percent (#45).

Both things would be nice to have, but I've held off on adding them to Stoplight in favor of keeping it simple. Yammer's Circuitbreaker gem can already do both of these things.

zhuochun commented 8 years ago

Agrees with your point. Will looking into your suggestions. Thanks