Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Conversation

@ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented Oct 29, 2024

Purpose/Motivation

This PR adds a new django command to be run on CRON clearing any lingering users who may have had a redis key for their rate limit failing to expire.

The command runs only on user's (non-anon) by default, but an option can be passed in to run the deletion on anon users instead as well. We utilize the scan_iter function on redis because it's capable of having a regex path passed in, from which we go through and delete each of the keys. We only delete keys which have no TTL (comes back as -1 when you call the ttl function)

Redis Scan Docs - https://redis.io/docs/latest/commands/scan/

Redis TTL Docs - https://redis.io/docs/latest/commands/ttl/

Closes #2527

Will need the second half to be completed by codecov/engineering-team#2588

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-notifications
Copy link

codecov-notifications bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
core/management/commands/delete_rate_limit_keys.py 84.21% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

Project coverage is 96.31%. Comparing base (cdebb02) to head (392e9d8).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
core/management/commands/delete_rate_limit_keys.py 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #935      +/-   ##
==========================================
+ Coverage   96.23%   96.31%   +0.08%     
==========================================
  Files         823      825       +2     
  Lines       18972    19476     +504     
==========================================
+ Hits        18257    18759     +502     
- Misses        715      717       +2     
Flag Coverage Δ
unit 92.49% <84.21%> (+0.01%) ⬆️
unit-latest-uploader 92.49% <84.21%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ajay-sentry ajay-sentry added this pull request to the merge queue Oct 30, 2024
Merged via the queue into main with commit 897327a Oct 30, 2024
16 of 19 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/rate-limit-key-removal branch October 30, 2024 16:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create GQL Rate Limit Bypass for Stage Users

3 participants