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

🌱 implement 1 QPS rate limiting for cron best practices worker. #4090

Merged
merged 2 commits into from May 8, 2024

Conversation

spencerschrock
Copy link
Contributor

What kind of change does this PR introduce?

bug fix

What is the current behavior?

We are getting connection reset requests from bestpractices.dev and 429 errors from our GCS bucket for too many writes.

bestpractices.dev has a limit of 1 QPS
GCS has a limit of 1000 QPS

What is the new behavior (if this is a feature change)?**

Use the lower limit of 1 QPS limit for bestpractices.dev when populating the cron data.
Each page has 30 projects, so 30 QPS is below the GCS limit.

The construct was taken from https://go.dev/wiki/RateLimiting which "works well for rates up to tens of operations per second."

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Related to #4037 (but may not fix it yet)

Special notes for your reviewer

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

NONE

We are getting connection reset requests from bestpractices.dev and 429
errors from our GCS bucket for too many writes. The GCS limit (1000 QPS)
is much higher, so just use the bestpractices.dev limit of 1 QPS.
https://github.com/coreinfrastructure/best-practices-badge/blob/main/docs/api.md

The construct was taken from https://go.dev/wiki/RateLimiting which "works well
for rates up to tens of operations per second."

Signed-off-by: Spencer Schrock <sschrock@google.com>
@spencerschrock spencerschrock requested a review from a team as a code owner May 7, 2024 22:26
@spencerschrock spencerschrock requested review from justaugustus and raghavkaul and removed request for a team May 7, 2024 22:26
@spencerschrock
Copy link
Contributor Author

Also linking #1240 for historical cross references. As this was originally proposed to deal with rate limiting

@spencerschrock spencerschrock merged commit cc7132d into ossf:main May 8, 2024
36 checks passed
@spencerschrock spencerschrock deleted the limit-cii-worker branch May 8, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants