mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-08 05:18:49 +03:00
refactor(core): remove redundant runtime scaffolding (#5127)
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user