redis / go-redis

Redis Go client
https://redis.uptrace.dev
BSD 2-Clause "Simplified" License
20.17k stars 2.37k forks source link

Allow for tracking state in Limiter #3148

Open AndreasBergmeier6176 opened 1 month ago

AndreasBergmeier6176 commented 1 month ago

Extend Allow and ReportResult functions to handle a Context. Allow can override the passed in Context. The returned Context is then further passed down to ReportResult. Using this Context it is then possible to store values/track state between Allow and ReportResult calls.

Without this tracking HalfOpen/Generation state is hard to implement efficiently for Circuit Breakers.