Merge branch 'reduce_main_loop' into integration

This commit is contained in:
J. Nick Koston 2025-07-04 11:24:46 -05:00
commit be2988b1d7
No known key found for this signature in database

View File

@ -33,14 +33,18 @@ async def test_defer_stress(
test_complete_future: asyncio.Future[None] = loop.create_future()
# Track executed defers and their order
executed_defers = set()
thread_executions = {} # thread_id -> list of indices in execution order
fifo_violations = []
executed_defers: set[int] = set()
thread_executions: dict[
int, list[int]
] = {} # thread_id -> list of indices in execution order
fifo_violations: list[str] = []
def on_log_line(line: str) -> None:
# Track all executed defers with thread and index info
match = re.search(r"Executed defer (\d+) \(thread (\d+), index (\d+)\)", line)
if match:
if not match:
return
defer_id = int(match.group(1))
thread_id = int(match.group(2))
index = int(match.group(3))
@ -52,10 +56,7 @@ async def test_defer_stress(
thread_executions[thread_id] = []
# Check FIFO ordering within thread
if (
thread_executions[thread_id]
and thread_executions[thread_id][-1] >= index
):
if thread_executions[thread_id] and thread_executions[thread_id][-1] >= index:
fifo_violations.append(
f"Thread {thread_id}: index {index} executed after {thread_executions[thread_id][-1]}"
)