feat: harden cron execution recovery and expose scheduling diagnostics

Reconcile scheduled and system cron triggers, isolate concurrent executions and retain verifiable exit statistics across restarts. Add paged task history, log and script browsing, dashboard timing details and regression coverage.
This commit is contained in:
whyour committed 2026-11-17 01:01:57 +08:00
1 parent 3b6a873520
commit 8a9e70e90b
166 files changed
+18942 -1800

No files matched your search

+5 -1
View File
@@ -30,6 +30,7 @@ for (const conflict of ['stop', 'newer-queue', 'stop-requeue']) {
pid: DataTypes.INTEGER,
log_path: DataTypes.STRING,
queued_token: DataTypes.STRING,
last_execution_time: DataTypes.INTEGER,
command: DataTypes.STRING,
});
const instances = db.define('Instance', {
@@ -38,6 +39,7 @@ for (const conflict of ['stop', 'newer-queue', 'stop-requeue']) {
pid: DataTypes.INTEGER,
});
await db.sync();
await db.transaction((tx) => require('../../back/shared/triggerHistory').installTriggerHistory(db, tx));
await crons.create({
id: 1,
status: 3,
@@ -110,7 +112,7 @@ for (const conflict of ['stop', 'newer-queue', 'stop-requeue']) {
await service.stop([1]);
// Queue again through the real API; leave the new runner pending.
const pendingRuns = [];
service.runSingle = (id, token) => pendingRuns.push({ id, token });
service.runSingle = async (id, token) => pendingRuns.push({ id, token });
await service.run([1]);
assert.equal(pendingRuns.length, 1);
assert.equal(
@@ -171,8 +173,10 @@ test('a runner waiting for a concurrency slot cannot adopt a newer queued genera
pid: DataTypes.INTEGER,
log_path: DataTypes.STRING,
queued_token: DataTypes.STRING,
last_execution_time: DataTypes.INTEGER,
});
await db.sync();
await db.transaction((tx) => require('../../back/shared/triggerHistory').installTriggerHistory(db, tx));
await crons.create({ id: 1, status: 1, log_path: 'same.log' });
const waiting = [];
const CronService = load('back/services/cron.ts', {