Skip to content

Conversation

@Akarys42
Copy link
Contributor

@Akarys42 Akarys42 commented May 28, 2021

This PR adds a rolling window logic as described in #91.

Closes #91.

jb3
jb3 previously approved these changes May 29, 2021
ChrisLovering
ChrisLovering previously approved these changes May 29, 2021
New headers:
- Requests-Remaining: (int) amount of interactions remaining.
- Requests-Limit: (int) maximum amount of interactions that can be done in the same period
- Requests-Period: (int) duration, in second, of a period
- Requests-Reset: (float) duration, in second, before getting all the interactions back
@Akarys42
Copy link
Contributor Author

New headers:

  • Requests-Remaining: (int) amount of interactions remaining.
  • Requests-Limit: (int) maximum amount of interactions that can be done in the same period
  • Requests-Period: (int) duration, in second, of a period
  • Requests-Reset: (float) duration, in second, before getting all the interactions back

@Akarys42 Akarys42 requested review from ChrisLovering and jb3 May 29, 2021 15:17
response.headers.append("Requests-Remaining", str(remaining_requests))
response.headers.append("Requests-Limit", str(self.LIMITS.requests))
response.headers.append("Requests-Period", str(self.LIMITS.time_unit))
response.headers.append("Requests-Reset", str(request_reset)[5:])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
response.headers.append("Requests-Reset", str(request_reset)[5:])
response.headers.append("Requests-Reset", str(request_reset)[:6])

Co-authored-by: Chris <chris.lovering.95@gmail.com>
@ChrisLovering ChrisLovering merged commit c58a400 into main May 29, 2021
@ChrisLovering ChrisLovering deleted the rolling-window branch May 29, 2021 16:06
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.

Change Redis ratelimits to be a rolling window

4 participants