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

Refactor the Discord Api Helper to use the RateLimiter #168

Merged
merged 2 commits into from
Oct 30, 2020

Conversation

damienalexandre
Copy link
Member

See #167

The HTTP Client we use have a ratelimiter: https://github.com/restcord/restcord/blob/master/src/RateLimit/RateLimiter.php
By default the state is stored in memory.

Our previous implementation was always rebuiling a new Client, so in the extractForGuild loop, it was always a fresh client and fresh rate limiter without the informations from the previous request.

This PR use always the same Client and that should allow us to benefit from the RateLimiter for user extraction AND message sending.

Copy link
Member

@pyrech pyrech left a comment

Choose a reason for hiding this comment

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

Good catch! Thanks!

@pyrech
Copy link
Member

pyrech commented Oct 29, 2020

Phpstan fails on the missing typehint on $client property 👼

@damienalexandre damienalexandre merged commit 1b0a3f9 into master Oct 30, 2020
@damienalexandre damienalexandre deleted the discordRateLimit branch October 30, 2020 10:42
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.

3 participants