Comcast / jrugged

A Java libary of robustness design patterns
Apache License 2.0
266 stars 93 forks source link

fix percentage failure when request threshold is configured #25

Closed jffmrk closed 10 years ago

jffmrk commented 10 years ago

I discovered a bug when using requestThreshold with percentage. If a the time window passed with no requests, the first request in the next window would properly set the previousRequestWindowHighWaterMark. However, each request after that would incorrectly reset previousRequestWindowHighWaterMark to -1. This would cause the percent calculation to be incorrect as the total request count would be used as the windowRequests, but only the number of errors in the last window are used. I wrote a test to demonstrate also. Thanks!

joercampbell commented 10 years ago

Thanks for the fix.