mirror of
https://github.com/sune-org/ORP.git
synced 2026-03-17 02:51:02 +00:00
Debug: Add heartbeat notification
This commit is contained in:
5
index.js
5
index.js
@@ -460,6 +460,11 @@ export class MyDurableObject {
|
|||||||
|
|
||||||
async Heart() {
|
async Heart() {
|
||||||
if (this.phase !== 'running' || !this.hbActive) return this.stopHeartbeat();
|
if (this.phase !== 'running' || !this.hbActive) return this.stopHeartbeat();
|
||||||
|
|
||||||
|
///////////// Debug: To be removed
|
||||||
|
this.notify(`Heartbeat for ${this.rid}: age ${this.age}`, 3, ['heartbeat']);
|
||||||
|
///////////// Debug: To be removed
|
||||||
|
|
||||||
if (++this.age * HB_INTERVAL_MS >= MAX_RUN_MS) return this.fail(`Run timed out after ${MAX_RUN_MS / 60000} minutes.`);
|
if (++this.age * HB_INTERVAL_MS >= MAX_RUN_MS) return this.fail(`Run timed out after ${MAX_RUN_MS / 60000} minutes.`);
|
||||||
await this.state.storage.setAlarm(Date.now() + HB_INTERVAL_MS).catch(() => {});
|
await this.state.storage.setAlarm(Date.now() + HB_INTERVAL_MS).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user