MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / get_unsent_batch_logs

Method get_unsent_batch_logs

src/web/task_manager.py:362–374  ·  view source on GitHub ↗

获取未发送给该 WebSocket 的批量任务日志

(self, batch_id: str, websocket)

Source from the content-addressed store, hash-verified

360 logger.warning(f"批量任务 WebSocket 连接已存在,跳过重复注册: {batch_id}")
361
362 def get_unsent_batch_logs(self, batch_id: str, websocket) -> List[str]:
363 """获取未发送给该 WebSocket 的批量任务日志"""
364 key = f"batch_{batch_id}"
365 with _ws_lock:
366 ws_id = id(websocket)
367 sent_count = _ws_sent_index.get(key, {}).get(ws_id, 0)
368
369 with _get_batch_lock(batch_id):
370 all_logs = _batch_logs.get(batch_id, [])
371 unsent_logs = all_logs[sent_count:]
372 # 更新已发送索引
373 _ws_sent_index[key][ws_id] = len(all_logs)
374 return unsent_logs
375
376 def unregister_batch_websocket(self, batch_id: str, websocket):
377 """注销批量任务 WebSocket 连接"""

Callers 1

batch_websocketFunction · 0.80

Calls 2

_get_batch_lockFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected