upstash/ratelimit-js

How to set one hour limit for sliding window?

samuelpalaciosdev opened this issue · 2 comments

Hey, I've been trying to setup my rate limiter like this:
const ratelimit = new Ratelimit({ redis: Redis.fromEnv(), limiter: Ratelimit.slidingWindow(2, '3600 s'), });
But it doesn't seem to work, there's a special way to reference an hour or theres a time limit?

Hey, can you try slidingWindow(2, "1 h")? The possible units are ms | s | m | h | d |

Thanks! didn't know that. It could be a good add to the documentation.