Skip to content

Add retry wrapper to all discord endpoints#1857

Merged
garrrikkotua merged 1 commit intomainfrom
feature/discord-rate-limits
Nov 20, 2023
Merged

Add retry wrapper to all discord endpoints#1857
garrrikkotua merged 1 commit intomainfrom
feature/discord-rate-limits

Conversation

@garrrikkotua
Copy link
Copy Markdown
Contributor

@garrrikkotua garrrikkotua commented Nov 20, 2023

Changes proposed ✍️

What

🤖[deprecated] Generated by Copilot at d44144d

This pull request improves the Discord integration by adding retry logic to handle rate limit errors from the Discord API. It refactors several functions in the integrations/discord/api directory to use the retryWrapper function from the handleRateLimit module. It also defines a custom RateLimitError class to distinguish rate limit errors from other types of errors.

🤖[deprecated] Generated by Copilot at d44144d

To handle the Discord API
We use a retryWrapper to retry
When we hit a rate limit
We don't throw a fit
We just wait and then call it again

Why

How

🤖[deprecated] Generated by Copilot at d44144d

  • Add retryWrapper function to handle rate limit errors from Discord API (link)
  • Import retryWrapper function and use it to wrap API calls in getChannel, getChannels, getMember, getMembers, getMessage, getMessages, and getThreads functions (link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Import RateLimitError class from @crowd/types and use it in handleDiscordError and retryWrapper functions (link)

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screenshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@garrrikkotua garrrikkotua merged commit 85f50c1 into main Nov 20, 2023
@garrrikkotua garrrikkotua deleted the feature/discord-rate-limits branch November 20, 2023 16:30
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.

1 participant