Refactor: Notify on run completion instead of start

This commit is contained in:
2025-11-06 19:38:04 -08:00
parent fe7eb38253
commit 8e03cbc764

View File

@@ -358,6 +358,7 @@ export class MyDurableObject {
} }
async stopHeartbeat() { async stopHeartbeat() {
if (!this.hbActive) return;
this.hbActive = false; this.hbActive = false;
const ageSeconds = (this.age * HB_INTERVAL_MS) / 1000; const ageSeconds = (this.age * HB_INTERVAL_MS) / 1000;
this.notify(`Run ${this.rid} ended. Phase: ${this.phase}. Age: ${ageSeconds.toFixed(1)}s.`, 3, ['stop_sign']); this.notify(`Run ${this.rid} ended. Phase: ${this.phase}. Age: ${ageSeconds.toFixed(1)}s.`, 3, ['stop_sign']);