fix(shipping-notice,admin-schedule,frontend): 修复发货通知与后台排程的业务bug并优化各模块功能
1. 后端发货通知模块:
清空重试任务旧状态避免残留,新增RPA进度回调接口
优化库存匹配性能,修复人工确认校验逻辑与登录弹窗遮挡问题
新增排程worker启动脚本,清理冗余环境配置与缓存查询开销
2. 前端后台排程模块:
新增任务key归一化工具兼容历史格式,修复参数表单隐藏问题
添加加载错误处理,更新多语言文案替换裸JSON占位符
This commit is contained in:
1 parent
1e5aedb9ed
commit
06c18b3c7c
81 files changed
+3301
-424
No files matched your search
@@ -235,3 +235,42 @@ def maybe_send_heartbeat(
|
||||
_start_heartbeat_request(payload)
|
||||
_LAST_HEARTBEAT_MONO = now
|
||||
return now
|
||||
|
||||
|
||||
def start_heartbeat_loop(
|
||||
*,
|
||||
trigger_dir: str | Path,
|
||||
drop_dir: str | Path,
|
||||
interval_seconds: float,
|
||||
) -> threading.Thread:
|
||||
"""
|
||||
启动独立守护心跳线程,使心跳节奏与业务主循环解耦。
|
||||
|
||||
核心逻辑:批量站点导出(浏览器登录+下载)会长时间阻塞 worker 主循环;若心跳由
|
||||
主循环发送,执行期间会停发,后端按心跳 TTL 误判 Worker 离线。本线程按固定间隔
|
||||
持续上报,主循环只负责业务扫描;线程内异常仅打印,绝不退出。
|
||||
|
||||
Args:
|
||||
trigger_dir: 触发目录(哨兵写入与心跳 payload 使用)。
|
||||
drop_dir: 库存落盘目录(心跳 payload 使用)。
|
||||
interval_seconds: 心跳间隔;实际以环境变量最小 15s 为准。
|
||||
|
||||
Returns:
|
||||
已启动的守护线程(daemon,随进程退出)。
|
||||
"""
|
||||
def _loop() -> None:
|
||||
while True:
|
||||
time.sleep(max(5.0, float(interval_seconds)))
|
||||
try:
|
||||
maybe_send_heartbeat(
|
||||
trigger_dir=trigger_dir,
|
||||
drop_dir=drop_dir,
|
||||
last_sent_mono=0.0,
|
||||
force=True,
|
||||
)
|
||||
except Exception:
|
||||
print("[heartbeat] loop tick failed", file=sys.stderr)
|
||||
|
||||
thread = threading.Thread(target=_loop, name="shipping-rpa-heartbeat-loop", daemon=True)
|
||||
thread.start()
|
||||
return thread
|
||||
Reference in new issue
Block a user