gradeup / ckt-breaker

Circuit breaker implementation in < 100 lines
MIT License
16 stars 0 forks source link

Why setInterval instead of timeout? #1

Open pateketrueke opened 7 years ago

pateketrueke commented 7 years ago

I like your project and reading between lines I found this:

https://github.com/gradeup/ckt-breaker/blob/d3cd3cbccf4cc509913803cc0cc4587253ec3aba/index.js#L40

I did not executed your code yet, but I can see those intervals will never cleared.

Is this right or i'm losing something?

niksrc commented 7 years ago

As you can see i maintain an error rate for the service, I have to reset current error count in each interval.