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

+91 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc v5.28.3
// protoc v5.29.0
// source: back/protos/cron.proto
/* eslint-disable */
@@ -31,6 +31,10 @@ export interface ICron {
command: string;
extra_schedules: ISchedule[];
name: string;
max_queue_wait?: number | undefined;
catchup_seconds?: number | undefined;
recovery_from?: number | undefined;
skip_if_pending?: boolean | undefined;
}
export interface AddCronRequest {
@@ -112,7 +116,17 @@ export const ISchedule: MessageFns<ISchedule> = {
};
function createBaseICron(): ICron {
return { id: "", schedule: "", command: "", extra_schedules: [], name: "" };
return {
id: "",
schedule: "",
command: "",
extra_schedules: [],
name: "",
max_queue_wait: undefined,
catchup_seconds: undefined,
recovery_from: undefined,
skip_if_pending: undefined,
};
}
export const ICron: MessageFns<ICron> = {
@@ -132,6 +146,18 @@ export const ICron: MessageFns<ICron> = {
if (message.name !== "") {
writer.uint32(42).string(message.name);
}
if (message.max_queue_wait !== undefined) {
writer.uint32(48).uint32(message.max_queue_wait);
}
if (message.catchup_seconds !== undefined) {
writer.uint32(56).uint32(message.catchup_seconds);
}
if (message.recovery_from !== undefined) {
writer.uint32(64).int64(message.recovery_from);
}
if (message.skip_if_pending !== undefined) {
writer.uint32(72).bool(message.skip_if_pending);
}
return writer;
},
@@ -182,6 +208,38 @@ export const ICron: MessageFns<ICron> = {
message.name = reader.string();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.max_queue_wait = reader.uint32();
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.catchup_seconds = reader.uint32();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.recovery_from = longToNumber(reader.int64());
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.skip_if_pending = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -200,6 +258,10 @@ export const ICron: MessageFns<ICron> = {
? object.extra_schedules.map((e: any) => ISchedule.fromJSON(e))
: [],
name: isSet(object.name) ? globalThis.String(object.name) : "",
max_queue_wait: isSet(object.max_queue_wait) ? globalThis.Number(object.max_queue_wait) : undefined,
catchup_seconds: isSet(object.catchup_seconds) ? globalThis.Number(object.catchup_seconds) : undefined,
recovery_from: isSet(object.recovery_from) ? globalThis.Number(object.recovery_from) : undefined,
skip_if_pending: isSet(object.skip_if_pending) ? globalThis.Boolean(object.skip_if_pending) : undefined,
};
},
@@ -220,6 +282,18 @@ export const ICron: MessageFns<ICron> = {
if (message.name !== "") {
obj.name = message.name;
}
if (message.max_queue_wait !== undefined) {
obj.max_queue_wait = Math.round(message.max_queue_wait);
}
if (message.catchup_seconds !== undefined) {
obj.catchup_seconds = Math.round(message.catchup_seconds);
}
if (message.recovery_from !== undefined) {
obj.recovery_from = Math.round(message.recovery_from);
}
if (message.skip_if_pending !== undefined) {
obj.skip_if_pending = message.skip_if_pending;
}
return obj;
},
@@ -233,6 +307,10 @@ export const ICron: MessageFns<ICron> = {
message.command = object.command ?? "";
message.extra_schedules = object.extra_schedules?.map((e) => ISchedule.fromPartial(e)) || [];
message.name = object.name ?? "";
message.max_queue_wait = object.max_queue_wait ?? undefined;
message.catchup_seconds = object.catchup_seconds ?? undefined;
message.recovery_from = object.recovery_from ?? undefined;
message.skip_if_pending = object.skip_if_pending ?? undefined;
return message;
},
};
@@ -618,6 +696,17 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function longToNumber(int64: { toString(): string }): number {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}