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

Log / respect rate limits #309

Merged
merged 1 commit into from
Mar 2, 2024
Merged

Log / respect rate limits #309

merged 1 commit into from
Mar 2, 2024

Conversation

zdrve
Copy link
Collaborator

@zdrve zdrve commented Mar 2, 2024

Thank you for your contribution!

Checklist

  • Verified against local install of kennel (using path: in Gemfile)
  • Added tests
  • Updated Readme.md (if user facing behavior changed)

https://github.com/zendesk/kennel/actions/runs/8120685832/job/22198172379#step:7:27

@zdrve zdrve force-pushed the zdrve/rate-limit branch from 07186b7 to 17c8c23 Compare March 2, 2024 05:30
@@ -5,6 +5,8 @@ module Kennel
class Api
CACHE_FILE = ENV.fetch("KENNEL_API_CACHE_FILE", "tmp/cache/details")

RateLimitParams = Data.define(:limit, :period, :remaining, :reset, :name)
Copy link
Owner

Choose a reason for hiding this comment

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

feels like you had too much golang for breakfast :D

Copy link
Owner

@grosser grosser left a comment

Choose a reason for hiding this comment

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

nice 🎉

@grosser
Copy link
Owner

grosser commented Mar 2, 2024

good to just merge right ... any gotchas you expect ?
... even if we do this in parallel it should be mostly fine right ?

@zdrve zdrve force-pushed the zdrve/rate-limit branch from 11e3178 to 17c8c23 Compare March 2, 2024 09:15
@zdrve
Copy link
Collaborator Author

zdrve commented Mar 2, 2024

good to just merge right ... any gotchas you expect ? ... even if we do this in parallel it should be mostly fine right ?

I think it's good, I've tested it out a fair bit (e.g. https://github.com/zendesk/kennel/actions/runs/8121811687 and others).

If the rate limit hits, then each thread that hits the rate limit will sleep – so typically you'd suddenly see 10 messages (1 per thread) saying "Rate limited, sleeping for [e.g.] 25 seconds". Then they all wake up and try again.

@zdrve zdrve merged commit dabba20 into master Mar 2, 2024
8 checks passed
@zdrve zdrve deleted the zdrve/rate-limit branch March 2, 2024 09:24
@grosser
Copy link
Owner

grosser commented Mar 3, 2024

v1.149.0

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.

2 participants