Skip to content

fix: require Python 3.14 and handle bot shutdown race#534

Merged
ReenigneArcher merged 1 commit into
masterfrom
fix/bot-shutdown
May 19, 2026
Merged

fix: require Python 3.14 and handle bot shutdown race#534
ReenigneArcher merged 1 commit into
masterfrom
fix/bot-shutdown

Conversation

@ReenigneArcher
Copy link
Copy Markdown
Member

Description

Bump pyproject minimum Python version and classifier to 3.14. In the bot, add an internal _stopping flag and a _run_threaded helper to run the event loop and suppress the "Session is closed" RuntimeError when shutdown is in progress. start_threaded now uses _run_threaded and sets _stopping=False, while shutdown sets _stopping=True before closing to avoid a race when stopping the threaded bot.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

Bump pyproject minimum Python version and classifier to 3.14. In the bot, add an internal _stopping flag and a _run_threaded helper to run the event loop and suppress the "Session is closed" RuntimeError when shutdown is in progress. start_threaded now uses _run_threaded and sets _stopping=False, while shutdown sets _stopping=True before closing to avoid a race when stopping the threaded bot.
@sonarqubecloud
Copy link
Copy Markdown

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.63%. Comparing base (1b62a04) to head (e84eca2).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/discord_bot/bot.py 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #534      +/-   ##
==========================================
+ Coverage   61.47%   61.63%   +0.16%     
==========================================
  Files          27       27              
  Lines        1978     1989      +11     
==========================================
+ Hits         1216     1226      +10     
- Misses        762      763       +1     
Files with missing lines Coverage Δ
src/discord_bot/bot.py 89.21% <90.90%> (+0.20%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b62a04...e84eca2. Read the comment docs.

@ReenigneArcher ReenigneArcher merged commit 9f3f1d2 into master May 19, 2026
17 checks passed
@ReenigneArcher ReenigneArcher deleted the fix/bot-shutdown branch May 19, 2026 00:06
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