Skip to content

fix: Ensure proper closure of database session with asyncio shield#1751

Merged
purplesmoke05 merged 1 commit intodev-26.3from
fix-gunicorn-asgi
Feb 5, 2026
Merged

fix: Ensure proper closure of database session with asyncio shield#1751
purplesmoke05 merged 1 commit intodev-26.3from
fix-gunicorn-asgi

Conversation

@YoshihitoAso
Copy link
Copy Markdown
Member

@YoshihitoAso YoshihitoAso commented Feb 1, 2026

📌 Description

Fixed asynchronous database session closes to be protected from cancellation.

✅ Related Issues

🔄 Changes

Async database session management:

  • The db_async_session function now uses asyncio.shield to protect the db.close() call from cancellation, ensuring the session is properly closed even if the coroutine is cancelled.

📌 Checklist

  • I have added tests where necessary.
  • I have updated the documentation where necessary.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 1, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
app/database
   __init__.py501276%48, 55, 73, 109–111, 113, 123–124, 132–133, 135
TOTAL46102155796% 

Tests Skipped Failures Errors Time
1504 0 💤 0 ❌ 0 🔥 12m 16s ⏱️

@YoshihitoAso YoshihitoAso added the enhancement New feature or request label Feb 2, 2026
@purplesmoke05 purplesmoke05 merged commit 14c6904 into dev-26.3 Feb 5, 2026
12 checks passed
@YoshihitoAso YoshihitoAso deleted the fix-gunicorn-asgi branch February 7, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants