From aa8b631724efb7c62c4b0d47c7b5dd004ee72758 Mon Sep 17 00:00:00 2001 From: KiriAky 107 Date: Sun, 6 Sep 2026 23:25:17 +0800 Subject: [PATCH] test: verify live chat agent MCP and task load flows --- backend/scripts/task-http-stress.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/scripts/task-http-stress.py b/backend/scripts/task-http-stress.py index bd59fd9..67f1b30 100644 --- a/backend/scripts/task-http-stress.py +++ b/backend/scripts/task-http-stress.py @@ -46,11 +46,15 @@ async def main(args): timings[kind].append((perf_counter()-start)*1000) response.raise_for_status() return response.json() + health_stop = asyncio.Event() async def health(): - while True: + while not health_stop.is_set(): try: await request('GET', '/health', 'health') except httpx.HTTPError as error: errors.append(type(error).__name__) - await asyncio.sleep(.05) + try: + await asyncio.wait_for(health_stop.wait(), timeout=.05) + except TimeoutError: + pass heartbeat = asyncio.create_task(health()) start = perf_counter() try: @@ -72,7 +76,8 @@ async def main(args): remaining = await request('GET', '/api/tasks', 'list') assert remaining['page']['total'] == 0 finally: - heartbeat.cancel(); await asyncio.gather(heartbeat, return_exceptions=True) + health_stop.set() + await asyncio.wait_for(heartbeat, timeout=35) report = {'transport': 'real loopback HTTP, separate Uvicorn process', 'tasks': args.count, 'concurrency': args.concurrency, 'elapsed_ms': round((perf_counter()-start)*1000, 2), 'latencies': {key: stats(value) for key,value in timings.items()}, 'health_errors': errors,