F4: verify task recovery and document Prompt background jobs

This commit is contained in:
Xin Wang
2026-10-23 16:27:00 +08:00
parent 9a4d48a86e
commit 8ac75a1873
14 changed files with 654 additions and 46 deletions
@@ -18,6 +18,26 @@ class Passthrough(FrameProcessor):
class NativeJobTest(unittest.IsolatedAsyncioTestCase):
async def test_native_timeout_calls_remote_cleanup(self):
cancelled = asyncio.Event()
async def execute(message, worker):
await asyncio.Event().wait()
async def cleanup(message):
cancelled.set()
async def ignore(message):
pass
runtime = NativeTaskRuntime(execute, cleanup, ignore, ignore)
await runtime.start()
try:
await runtime.submit("timeout-test", 0.05)
await asyncio.wait_for(cancelled.wait(), 2)
finally:
await runtime.close()
async def test_progress_completion_and_media_disconnect(self):
progress, finished, release = asyncio.Event(), asyncio.Event(), asyncio.Event()
results = []