jbc-dssi 1.1.140 → 1.1.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/restart-autocheck.js +8 -2
- package/package.json +1 -1
package/lib/restart-autocheck.js
CHANGED
|
@@ -117,14 +117,20 @@ export function readPendingTasks(filePath, ttlMs = 24 * 60 * 60 * 1000, now = Da
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* 标记这批待续任务"已呈现"——**呈现即从队列删除**(2026-11-18 老谢定)。
|
|
122
|
+
*
|
|
123
|
+
* 事故:重启接续那行的「待续任务」里贴出一条 11.6 小时前问过、早已处理完的老问题。
|
|
124
|
+
* 根因:原实现只给条目打 `presentedAt` 标记、不删条目,一直躺到 24h TTL 才清。
|
|
125
|
+
* 口径:呈现 = 已尽力接续,删掉才对;真没处理完的,下一轮用户消息会重新入队,不会丢。
|
|
126
|
+
*/
|
|
121
127
|
export function markPendingTasksPresented(filePath, taskIds, now = Date.now()) {
|
|
122
128
|
if (!Array.isArray(taskIds) || taskIds.length === 0) return false;
|
|
123
129
|
try {
|
|
124
130
|
const parsed = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
125
131
|
const tasks = Array.isArray(parsed?.tasks) ? parsed.tasks : [];
|
|
126
132
|
const set = new Set(taskIds);
|
|
127
|
-
const next = tasks.
|
|
133
|
+
const next = tasks.filter((t) => !(t && set.has(t.taskId)));
|
|
128
134
|
writeFileSync(filePath, `${JSON.stringify({ v: 1, tasks: next }, null, 2)}\n`, 'utf8');
|
|
129
135
|
return true;
|
|
130
136
|
} catch {
|