fix: log heartbeat failure reasons
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Heartbeat replies now strip repeated `HEARTBEAT_OK` tails to avoid accidental “OK OK” spam.
|
- Heartbeat replies now strip repeated `HEARTBEAT_OK` tails to avoid accidental “OK OK” spam.
|
||||||
|
- Heartbeat failure logs now include the error reason instead of `[object Object]`.
|
||||||
- Duration strings now accept `h` (hours) where durations are parsed (e.g., heartbeat intervals).
|
- Duration strings now accept `h` (hours) where durations are parsed (e.g., heartbeat intervals).
|
||||||
- WhatsApp send now preserves existing JIDs (including group `@g.us`) instead of coercing to `@s.whatsapp.net`. (Thanks @arun-8687.)
|
- WhatsApp send now preserves existing JIDs (including group `@g.us`) instead of coercing to `@s.whatsapp.net`. (Thanks @arun-8687.)
|
||||||
- Telegram/WhatsApp: reply context stays in `Body`/`ReplyTo*`, but outbound replies no longer thread to the original message. (Thanks @joshp123 for the PR and follow-up question.)
|
- Telegram/WhatsApp: reply context stays in `Body`/`ReplyTo*`, but outbound replies no longer thread to the original message. (Thanks @joshp123 for the PR and follow-up question.)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
saveSessionStore,
|
saveSessionStore,
|
||||||
type SessionEntry,
|
type SessionEntry,
|
||||||
} from "../config/sessions.js";
|
} from "../config/sessions.js";
|
||||||
|
import { formatErrorMessage } from "../infra/errors.js";
|
||||||
import { createSubsystemLogger } from "../logging.js";
|
import { createSubsystemLogger } from "../logging.js";
|
||||||
import { getQueueSize } from "../process/command-queue.js";
|
import { getQueueSize } from "../process/command-queue.js";
|
||||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||||
@@ -367,13 +368,14 @@ export async function runHeartbeatOnce(opts: {
|
|||||||
});
|
});
|
||||||
return { status: "ran", durationMs: Date.now() - startedAt };
|
return { status: "ran", durationMs: Date.now() - startedAt };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
const reason = formatErrorMessage(err);
|
||||||
emitHeartbeatEvent({
|
emitHeartbeatEvent({
|
||||||
status: "failed",
|
status: "failed",
|
||||||
reason: String(err),
|
reason,
|
||||||
durationMs: Date.now() - startedAt,
|
durationMs: Date.now() - startedAt,
|
||||||
});
|
});
|
||||||
log.error("heartbeat failed", { error: String(err) });
|
log.error(`heartbeat failed: ${reason}`, { error: reason });
|
||||||
return { status: "failed", reason: String(err) };
|
return { status: "failed", reason };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user