mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 02:48:27 +00:00
fix (cron): skip startup replay for interrupted running jobs
This commit is contained in:
@@ -357,11 +357,15 @@ function findDueJobs(state: CronServiceState): CronJob[] {
|
||||
});
|
||||
}
|
||||
|
||||
export async function runMissedJobs(state: CronServiceState) {
|
||||
export async function runMissedJobs(
|
||||
state: CronServiceState,
|
||||
opts?: { skipJobIds?: ReadonlySet<string> },
|
||||
) {
|
||||
if (!state.store) {
|
||||
return;
|
||||
}
|
||||
const now = state.deps.nowMs();
|
||||
const skipJobIds = opts?.skipJobIds;
|
||||
const missed = state.store.jobs.filter((j) => {
|
||||
if (!j.state) {
|
||||
j.state = {};
|
||||
@@ -369,6 +373,9 @@ export async function runMissedJobs(state: CronServiceState) {
|
||||
if (!j.enabled) {
|
||||
return false;
|
||||
}
|
||||
if (skipJobIds?.has(j.id)) {
|
||||
return false;
|
||||
}
|
||||
if (typeof j.state.runningAtMs === "number") {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user