mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-04-02 06:25:17 +08:00
fix(path): 修复路径执行异常时的记录清理问题
- 在路径执行开始时记录时间戳以确保一致性 - 路径执行失败时删除对应的路径记录 - 执行失败时同步删除错误路径并保存记录 - 任务组执行失败时删除对应的分组路径记录
This commit is contained in:
@@ -1443,6 +1443,7 @@ async function runPath(path) {
|
||||
|
||||
|
||||
//切换队伍-end
|
||||
const now = Date.now();
|
||||
try {
|
||||
log.info("开始执行路径: {path}", path)
|
||||
await pathingScript.runFile(path)
|
||||
@@ -1452,11 +1453,14 @@ async function runPath(path) {
|
||||
await realTimeMissions(false)
|
||||
}
|
||||
log.debug("路径执行完成: {path}", path)
|
||||
RecordPath.paths.add({timestamp: Date.now(), path: path})
|
||||
RecordPath.paths.add({timestamp: now, path: path})
|
||||
await saveRecordPaths()
|
||||
Record.paths.add(path)
|
||||
Record.errorPaths.delete(path)
|
||||
} catch (error) {
|
||||
RecordPath.paths.delete({timestamp: now, path: path})
|
||||
await saveRecordPaths()
|
||||
Record.paths.delete(path)
|
||||
Record.errorPaths.add(path)
|
||||
log.error("路径执行失败: {path}, 错误: {error}", path, error.message)
|
||||
} finally {
|
||||
@@ -1555,6 +1559,10 @@ async function runMap(map = new Map()) {
|
||||
})
|
||||
log.debug(`[{0}] 任务[{1}]执行完成`, settings.mode, key);
|
||||
} catch (error) {
|
||||
Record.groupPaths.delete({
|
||||
name: key,
|
||||
paths: new Set(one.paths)
|
||||
})
|
||||
log.error(`[{0}] 任务[{1}]执行失败: {error}`, settings.mode, key, error.message);
|
||||
continue; // 继续执行下一个任务
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user