Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 26_ux #97 +/- ##
==========================================
- Coverage 67.86% 67.57% -0.30%
==========================================
Files 62 62
Lines 3772 3781 +9
==========================================
- Hits 2560 2555 -5
- Misses 1212 1226 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The CI failure looks unrelated to this change. In Removing the |
|
Thanks @PaulM5406, luckily fixed upstream so we can skip this one (see #58). I'll take a look at that race test... |
Hey @TkTech,
I used Astra to help me with this one.
Python 3.11's
asyncio.wait_for()can swallow cancellation when its inner awaitable finishes concurrently. If this happens inside Psycopg, a worker polling task can keep running afterTaskManager.cancel_all()has cancelled it, leaving final teardown waiting indefinitely.Restore pending cancellation at Chancy's polling boundaries, after database contexts have exited. The shared sleep helper covers worker and plugin polling, including retry delays. Read notifications in one-second windows on the same connection, checking cancellation between windows and before dispatching a notification.
This addresses the shutdown race discussed in #58 and psycopg#1413. It does not change Psycopg or require a Python upgrade. Arbitrary cancellation-resistant user jobs and database operations that never return remain outside this fix.