Skip to content

Conversation

@yarjor
Copy link

@yarjor yarjor commented Mar 29, 2025

Added an option to apply a circuit breaker to the rate limiter, in order to better handle temporary unavailability of Redis (as raised in #54 )

@app.get(
    "/circuit-breaker", 
    dependencies=[Depends(RateLimiter(times=1, seconds=5, circuit_breaker=(2, 5)))])
async def circuit_breaker():
    return {"msg": "Hello World"}
# This example will stop ratelimiting on the second connection error,
# and retry after 5 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants