ethernet
cbc82511ea
fix(web-server): move event channel state from module globals to app.state ( #37683 )
...
Module-level asyncio.Lock() binds to whatever event loop was active at
import time. When the same web_server module is reused across multiple
TestClient instances (or across uvicorn reloads), the old lock still
references a defunct loop, causing 'attached to a different loop' errors
and flaky subscriber-registration races in CI.
Replace the module-level _event_channels dict + _event_lock with:
- _lifespan() async context manager that creates both on the running
event loop during FastAPI startup (guaranteed correct loop binding)
- _get_event_state() lazy accessor that initialises on app.state when
TestClient is used without a `with` block (preserves backward compat)
All call sites (_broadcast_event, /api/pub, /api/events) now receive the
app reference and read state via _get_event_state(app) instead of the
module globals. The test polling loop is updated to check
app.state.event_channels rather than the removed module attribute.
2026-06-02 18:40:12 -05:00
..
2026-06-02 21:16:41 +10:00
2026-05-29 04:22:27 -07:00
2026-05-28 18:11:49 -07:00
2026-05-23 21:03:51 -07:00
2026-05-28 22:26:25 -07:00
2026-06-02 12:19:44 -05:00
2026-06-02 12:19:44 -05:00
2026-05-18 10:14:38 -07:00
2026-05-29 13:22:54 -07:00
2026-05-30 02:53:37 -07:00
2026-05-19 22:34:05 -07:00
2026-05-28 15:14:05 +10:00
2026-05-28 22:26:25 -07:00
2026-05-25 01:20:33 -07:00
2026-05-28 22:26:25 -07:00
2026-06-01 19:51:03 -07:00
2026-05-25 01:20:33 -07:00
2026-05-13 22:54:21 -07:00
2026-05-27 12:16:15 -07:00
2026-05-15 02:31:30 -07:00
2026-05-17 02:29:41 -07:00
2026-03-30 17:07:21 -07:00
2026-06-01 22:28:36 -04:00
2026-06-01 19:51:03 -07:00
2026-06-02 05:52:54 -07:00
2026-06-01 11:28:56 +10:00
2026-05-11 11:13:25 -07:00
2026-05-30 23:05:56 -07:00
2026-05-11 11:13:25 -07:00
2026-06-01 16:58:58 -07:00
2026-05-29 04:22:27 -07:00
2026-03-26 01:34:27 -07:00
2026-05-18 16:34:24 +05:30
2026-05-11 11:13:25 -07:00
2026-05-30 00:32:05 -07:00
2026-05-28 15:14:05 +10:00
2026-05-25 15:18:55 -07:00
2026-05-23 05:24:57 -07:00
2026-05-23 05:24:57 -07:00
2026-05-28 03:25:32 -07:00
2026-06-01 19:51:03 -07:00
2026-05-31 01:16:33 -07:00
2026-05-11 11:13:25 -07:00
2026-05-31 17:46:56 -05:00
2026-06-01 20:26:57 -07:00
2026-05-27 22:07:49 -07:00
2026-05-29 04:22:27 -07:00
2026-05-27 22:07:49 -07:00
2026-05-28 21:00:46 -07:00
2026-05-31 01:16:33 -07:00
2026-05-31 17:46:56 -05:00
2026-06-02 15:45:30 -04:00
2026-05-28 22:26:25 -07:00
2026-05-29 12:32:19 -07:00
2026-05-26 12:48:14 -07:00
2026-05-30 07:45:26 -07:00
2026-05-29 22:29:48 -07:00
2026-05-20 09:18:23 -07:00
2026-05-31 00:29:40 -07:00
2026-05-27 00:43:32 -07:00
2026-06-01 20:27:41 -07:00
2026-06-02 12:49:19 -07:00
2026-06-01 06:32:48 +05:30
2026-06-01 06:32:48 +05:30
2026-05-30 07:31:48 -07:00
2026-05-07 07:18:21 -07:00
2026-05-29 17:49:15 -07:00
2026-04-29 21:56:51 -07:00
2026-05-31 17:46:56 -05:00
2026-05-28 22:26:25 -07:00
2026-05-29 04:22:27 -07:00
2026-05-28 22:26:25 -07:00
2026-05-25 05:07:58 -07:00
2026-05-29 22:29:48 -07:00
2026-05-30 02:53:42 -07:00
2026-06-02 06:31:37 -07:00
2026-05-28 02:36:09 -07:00
2026-05-29 00:31:44 -07:00
2026-05-11 11:13:25 -07:00
2026-05-08 14:27:40 -07:00
2026-05-29 02:24:48 -07:00
2026-05-25 01:20:33 -07:00
2026-05-28 22:26:25 -07:00
2026-05-29 13:24:12 -07:00
2026-05-28 22:26:25 -07:00
2026-05-16 23:00:58 -05:00
2026-06-01 13:54:18 +10:00
2026-05-17 02:29:41 -07:00
2026-06-01 01:58:30 -07:00
2026-04-29 04:03:03 -07:00
2026-06-01 19:52:28 -07:00
2026-05-18 20:05:23 -07:00
2026-05-08 17:01:12 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-19 14:25:10 -07:00
2026-05-30 18:58:46 -07:00
2026-06-01 06:32:48 +05:30
2026-05-29 17:24:38 -07:00
2026-05-06 15:49:59 -07:00
2026-06-02 18:40:12 -05:00
2026-05-24 04:55:18 -07:00
2026-05-20 09:18:23 -07:00