refactor(core): remove redundant runtime scaffolding (#5127)

This commit is contained in:
chengyongru
2026-07-28 11:07:58 +08:00
committed by GitHub
parent 4c77126b3d
commit ef9e687f19
19 changed files with 89 additions and 312 deletions
+4 -4
View File
@@ -454,7 +454,7 @@ class TestStopCommandWithUnifiedSession:
# Simulate the task creation flow (from _run loop)
effective_key = UNIFIED_SESSION_KEY if loop._unified_session and not msg.session_key_override else msg.session_key
task = asyncio.create_task(loop._dispatch(msg))
loop._active_tasks.setdefault(effective_key, []).append(task)
loop._active_tasks.setdefault(effective_key, set()).add(task)
# Wait for task to complete
await task
@@ -475,7 +475,7 @@ class TestStopCommandWithUnifiedSession:
await asyncio.sleep(10) # Will be cancelled
task = asyncio.create_task(long_running())
loop._active_tasks[UNIFIED_SESSION_KEY] = [task]
loop._active_tasks[UNIFIED_SESSION_KEY] = {task}
# Create a message that would have session_key=UNIFIED_SESSION_KEY after dispatch
msg = InboundMessage(
@@ -506,7 +506,7 @@ class TestStopCommandWithUnifiedSession:
await asyncio.sleep(10)
task = asyncio.create_task(long_running())
loop._active_tasks[UNIFIED_SESSION_KEY] = [task]
loop._active_tasks[UNIFIED_SESSION_KEY] = {task}
msg = InboundMessage(
channel="telegram",
chat_id="123456",
@@ -533,7 +533,7 @@ class TestStopCommandWithUnifiedSession:
task1 = asyncio.create_task(long_running())
task2 = asyncio.create_task(long_running())
loop._active_tasks[UNIFIED_SESSION_KEY] = [task1, task2]
loop._active_tasks[UNIFIED_SESSION_KEY] = {task1, task2}
# /stop from discord should cancel tasks started from telegram
msg = InboundMessage(