refactor(pymsg): 新增AsyncRpcQueue通用异步队列,log_client基于此重构
- pymsg新增AsyncRpcQueue:提供内存队列+后台线程+攒批处理的通用异步基础设施, 支持两种模式:简单RPC模式(client+method+serialize)和自定义handler模式 - confs/dnfs/static的log_client.py重构为基于AsyncRpcQueue的薄封装, 保持API完全向后兼容(push/info/error/warning/debug/critical + 全局logs单例) - 消除了三份log_client副本中重复的队列/线程/攒批逻辑(约150行/份), 代码量净减少约50行 - LogClient的行为与旧版一致:逐条INSERT到db、fail-fast网络错误、队列满丢最旧
This commit is contained in:
1 parent
101aed48be
commit
d883dc620e
5 files changed
+384
-433
No files matched your search
@@ -525,5 +525,6 @@ class MsgServer:
|
||||
|
||||
# ── JSON RPC 约定层(依赖上面的 MsgClient / MsgServer,故放在末尾导入)──
|
||||
from .rpc import RpcClient, RpcError, RpcServer # noqa: E402
|
||||
from .async_queue import AsyncRpcQueue # noqa: E402
|
||||
|
||||
__all__ += ["RpcClient", "RpcServer", "RpcError"]
|
||||
__all__ += ["RpcClient", "RpcServer", "RpcError", "AsyncRpcQueue"]
|
||||
Reference in new issue
Block a user