@limiter.limit("1/second") not working
moo611 opened this issue · 5 comments
moo611 commented
it worked based on minute, but not working based on second
moo611 commented
this is my code
@app.get("/test")
@limiter.limit("1/second")
async def test(request: Request):
time.sleep(2)
return "hello"
nocturn9x commented
why would you use time.sleep()
in an async function?! It seems you need to learn how to use Python before using this library...
laurentS commented
Let's try and be kind to each other.
@moo611 can you explain a bit more what you are trying to do? As @nocturn9x pointed out, your example is a bit confusing.
Can you also clarify what you mean by "it's not working". Do you get a specific error?
moo611 commented
Ok, it's my mistake.Just as @nocturn9x say, I should not use time.sleep in an async function.
laurentS commented
Glad you found your problem. Can we close this issue?