fix: support per-sentinel scheduler timers

This commit is contained in:
Codex
2026-06-27 07:55:37 +00:00
parent 1ef4bf58d6
commit fcf0dd12bf
+5 -3
View File
@@ -125,7 +125,7 @@ async function runScheduler(options: SchedulerOptions): Promise<void> {
const status = due ? options.dryRun ? "due-dry-run" : trigger?.status ?? "due" : "fresh";
const row = rowFor(schedule, before, due, status, trigger);
rows.push(row);
appendEvent({ at: new Date().toISOString(), node: options.node, lane: options.lane, ...row, valuesRedacted: true });
if (!options.dryRun) appendEvent({ at: new Date().toISOString(), node: options.node, lane: options.lane, ...row, valuesRedacted: true });
}
printRows(rows);
@@ -257,6 +257,7 @@ function installSystemd(options: SchedulerOptions): void {
const unit = systemdUnitName(options);
const servicePath = `/etc/systemd/system/${unit}.service`;
const timerPath = `/etc/systemd/system/${unit}.timer`;
const sentinelArg = options.sentinelId === null ? "" : ` --sentinel ${options.sentinelId}`;
const service = `[Unit]
Description=UniDesk web-probe sentinel host cadence scheduler for ${options.node}/${options.lane}
Wants=network-online.target
@@ -269,7 +270,7 @@ Environment=PATH=${SYSTEMD_PATH}
Environment=NO_PROXY=${SYSTEMD_NO_PROXY}
Environment=no_proxy=${SYSTEMD_NO_PROXY}
WorkingDirectory=${repoRoot}
ExecStart=${BUN_EXECUTABLE} ${join(repoRoot, "scripts", "web-probe-sentinel-scheduler.ts")} run --node ${options.node} --lane ${options.lane} --stale-multiplier ${options.staleMultiplier}
ExecStart=${BUN_EXECUTABLE} ${join(repoRoot, "scripts", "web-probe-sentinel-scheduler.ts")} run --node ${options.node} --lane ${options.lane}${sentinelArg} --stale-multiplier ${options.staleMultiplier}
`;
const timer = `[Unit]
Description=Run UniDesk web-probe sentinel host cadence scheduler for ${options.node}/${options.lane}
@@ -555,7 +556,8 @@ function tail(value: string, maxChars: number): string {
}
function systemdUnitName(options: SchedulerOptions): string {
return `unidesk-web-probe-sentinel-scheduler-${safeSegment(options.node)}-${safeSegment(options.lane)}`;
const sentinel = options.sentinelId === null ? "" : `-${safeSegment(options.sentinelId)}`;
return `unidesk-web-probe-sentinel-scheduler-${safeSegment(options.node)}-${safeSegment(options.lane)}${sentinel}`;
}
function safeSegment(value: string): string {