|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| Request | _request (str|None email) |
| _thread_used_by_set_config (run_endpoint) | |
| test_switch_offloads_set_config_off_the_event_loop () | |
| test_load_offloads_set_config_off_the_event_loop () | |
Config endpoints must not run set_config on the event loop. set_config builds/loads the CEA cache (PintleEngineRunner). For a propellant whose cache is not yet committed that is a multi-minute *synchronous* build, and running it on the asyncio event loop freezes every other request -- health included -- which is the "stuck on Connecting…" hang the frontend showed. The fix is to offload set_config via run_in_threadpool in the async config endpoints. This test pins that invariant behaviorally without any HTTP/async test harness (none is in the CI subset): it records the thread set_config runs on and asserts it is NOT the event-loop thread. Revert the offload and set_config runs inline on the loop thread -> this fails. Mirrors test_session_isolation.py: real sessions via get_session, endpoint coroutines driven directly with asyncio.run.
|
protected |
Definition at line 30 of file test_config_endpoints_offload.py.
Referenced by _thread_used_by_set_config().
|
protected |
Drive `run_endpoint(session)` on a fresh event loop, capturing the thread id set_config executed on and the event-loop thread id. Returns (loop_tid, set_config_tid).
Definition at line 43 of file test_config_endpoints_offload.py.
References _request(), and main().
Referenced by test_load_offloads_set_config_off_the_event_loop(), and test_switch_offloads_set_config_off_the_event_loop().
| test_config_endpoints_offload.test_load_offloads_set_config_off_the_event_loop | ( | ) |
Definition at line 86 of file test_config_endpoints_offload.py.
References _thread_used_by_set_config().
| test_config_endpoints_offload.test_switch_offloads_set_config_off_the_event_loop | ( | ) |
Definition at line 68 of file test_config_endpoints_offload.py.
References _thread_used_by_set_config().