fix(cron): split run and delivery status tracking

This commit is contained in:
Peter Steinberger
2026-02-22 20:07:34 +01:00
parent c3bb723673
commit aa4c250eb8
11 changed files with 128 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
import fs from "node:fs/promises";
import path from "node:path";
import type { CronRunStatus, CronRunTelemetry } from "./types.js";
import type { CronDeliveryStatus, CronRunStatus, CronRunTelemetry } from "./types.js";
export type CronRunLogEntry = {
ts: number;
@@ -10,6 +10,8 @@ export type CronRunLogEntry = {
error?: string;
summary?: string;
delivered?: boolean;
deliveryStatus?: CronDeliveryStatus;
deliveryError?: string;
sessionId?: string;
sessionKey?: string;
runAtMs?: number;
@@ -131,6 +133,17 @@ export async function readCronRunLogEntries(
if (typeof obj.delivered === "boolean") {
entry.delivered = obj.delivered;
}
if (
obj.deliveryStatus === "delivered" ||
obj.deliveryStatus === "not-delivered" ||
obj.deliveryStatus === "unknown" ||
obj.deliveryStatus === "not-requested"
) {
entry.deliveryStatus = obj.deliveryStatus;
}
if (typeof obj.deliveryError === "string") {
entry.deliveryError = obj.deliveryError;
}
if (typeof obj.sessionId === "string" && obj.sessionId.trim().length > 0) {
entry.sessionId = obj.sessionId;
}