Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 4, 2025

Analyzing Discord rate limiting concerns raised in PR comments and planning solution.

Analysis Complete

  • Understand the rate limiting concern
  • Analyze current Discord API usage patterns
  • Review Discord model fields and update frequency needs
  • Run ruff format on code files
  • Add timestamp tracking for Discord data updates
  • Implement time-based throttling for Discord updates
  • Update background task to respect throttling
  • Add configuration for update frequency
  • Test the rate limiting solution
  • Reply to comments with implemented solution

Rate Limiting Concern

The concern is valid: current implementation makes Discord API calls (/users/@me) on every login, which could hit Discord's rate limits (typically 5 requests/5 seconds) during high traffic periods.

Planned Solution

Implement time-based throttling:

  1. Add last_discord_update timestamp to DiscordModel
  2. Only update Discord data if >24 hours since last update
  3. Preserve immediate updates for new users
  4. Make update frequency configurable

Code Formatting

  • Applied ruff formatting to all modified files per feedback

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add background task to update discord model upon user login Add background task to update Discord model upon user login for existing users Sep 4, 2025
@Copilot Copilot AI requested a review from jontyms September 4, 2025 11:37
Copilot finished work on behalf of jontyms September 4, 2025 11:37
@jontyms
Copy link
Member

jontyms commented Sep 18, 2025

Rate limiting concerns me

@jontyms jontyms self-requested a review September 18, 2025 22:33
Copy link
Member

@jontyms jontyms left a comment

Choose a reason for hiding this comment

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

@copilot Consider discord rate limits

@jontyms
Copy link
Member

jontyms commented Sep 18, 2025

@copilot Consider discord rate limits

@jontyms
Copy link
Member

jontyms commented Sep 18, 2025

@copilot also run ruff format

@Copilot Copilot AI requested a review from jontyms September 18, 2025 22:45
@jontyms jontyms marked this pull request as ready for review September 18, 2025 22:46
@jontyms jontyms merged commit e6c4296 into dev Sep 18, 2025
9 of 12 checks passed
Copy link
Contributor Author

Copilot AI commented Sep 18, 2025

@copilot also run ruff format

Done! Applied ruff formatting to all files. The formatting changes include quote normalization, trailing comma addition, and whitespace cleanup. Commit: 75f0f54

Copilot finished work on behalf of jontyms September 18, 2025 22:50
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