laurentS/slowapi

@limiter.limit("1/second") not working

moo611 opened this issue · 5 comments

it worked based on minute, but not working based on second

this is my code

@app.get("/test")
@limiter.limit("1/second")
async def test(request: Request):
    time.sleep(2)
    return "hello"

why would you use time.sleep() in an async function?! It seems you need to learn how to use Python before using this library...

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?

Ok, it's my mistake.Just as @nocturn9x say, I should not use time.sleep in an async function.

Glad you found your problem. Can we close this issue?