fix: Handling of site connection issues during outage#3470
Open
rippyboii wants to merge 140 commits intopython-discord:mainfrom
Open
fix: Handling of site connection issues during outage#3470rippyboii wants to merge 140 commits intopython-discord:mainfrom
rippyboii wants to merge 140 commits intopython-discord:mainfrom
Conversation
import the report markdown template from the assignment instructions.
Alerts the moderators through a discord error message if the loading of the Reminders Cog has failed.
…tries from contants.py #13
Adds retry logic with time buff to `Filtering.cog_load()`
Changed cog_load() function to retry connecting to api if it fails initially with an exponential delay and limited max attempts.
Rewrote requirements to adhere to the assignment specifications.
Add test cases for retrying cog loads and skeleton for new functions
Author
|
Hi @jb3 , Thank you so much for bringing out the suggestions. We have followed your guidance and implemented the refactor to most of it. Could you please review it once again in your free time? Thank you so much |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves bot startup reliability and moderator visibility when extensions/cogs fail to load.
#mod-log.During
setup_hook, extensions are loaded concurrently. When an extension/cog fails due to a transient outage (rate limits, 5xx, timeouts), failures can either:This change standardizes both resilience (retry when appropriate) and visibility (one clean startup report + targeted alerts).
Changes
1) Startup failure aggregation (single
#mod-logalert)utils/startup_reporting.pyto format a standardized startup failure message.bot.pyto:2) Retry + backoff for external/API-dependent cogs
Implemented retry logic with exponential backoff and explicit “retriable vs non-retriable” classification, plus moderator notifications when retries are exhausted.
Covered cogs include:
HTTP 429,HTTP 5xx,TimeoutError,OSError; final failure logs + alerts#mod-alerts.URLs.connect_max_retries; warns are logged to Sentry; final failure posts to#mod-log.408,429,5xx,TimeoutError,OSError; on max retries logs + alertsmod_alertsand re-raises to stop startup.Tests / Verification
Suggested checks:
uv run task test#mod-logstartup alert.Moderator Alert in Discord:
Closes #2918