Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need docs on "How does this work" #181

Open
jensenbox opened this issue Jun 11, 2019 · 3 comments
Open

Need docs on "How does this work" #181

jensenbox opened this issue Jun 11, 2019 · 3 comments

Comments

@jensenbox
Copy link

Granted I know how it works but a new person just coming to this project needs to know how the internals do what it needs and the prerequisites - like having a cache set up.

@jsocol
Copy link
Owner

jsocol commented Jun 11, 2019

I think there’s a little overlap here with #120.

I’m definitely down to add more docs, especially in the getting started section if we’ve glossed over prereqs!

From a purely information architecture standpoint though, I would want to think about where to put/what to document in the “how this works internally” realm. I don’t think it’s critical for a new person using the library to know all the details and don’t want to overload new folks, but want to support advanced users/contributors/debuggers.

@hartwork
Copy link
Contributor

hartwork commented Dec 21, 2019

I think one implementation detail that would be important to document to users is that Django Ratelimit uses modulo operation so that 1/m would allow two requests only few second apart if the clock is near the full minute, while a user could assume that 1/m would enforce >=60 seconds between two unblocked requests. What do you think? Is that documented somewhere?

In code:

w = ts - (ts % period) + (zlib.crc32(value) % period)

@jsocol jsocol closed this as completed in f3d40f1 Jun 30, 2020
@jsocol jsocol reopened this Jul 1, 2020
@alexirpan
Copy link

I just hit the same behavior that @hartwork mentioned, I thought a limit of 3/m would limit there to be at most 3 requests in any 1 minute block of time, but the behavior in code is to slice time into 1 minute chunks and allow at most 3 request per chunk (which allows up to 6 requests in a few seconds if they're sent between switch between 2 minutes.) I didn't find any part of the documentation which mentioned this.

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

Successfully merging a pull request may close this issue.

4 participants