import type { ChannelId } from "../channels/plugins/types.public.js"; import { createSubsystemLogger } from "../logging/subsystem.js"; import {
DEFAULT_CHANNEL_CONNECT_GRACE_MS,
DEFAULT_CHANNEL_STALE_EVENT_THRESHOLD_MS,
evaluateChannelHealth,
resolveChannelRestartReason,
type ChannelHealthPolicy,
} from "./channel-health-policy.js"; import type { ChannelManager } from "./server-channels.js";
/** * How long a connected channel can go without proven transport activity before * the health monitor treats it as a "stale socket" and triggers a restart. * Providers should only publish that timestamp from transport/heartbeat/poll * signals, not from ordinary app messages.
*/
export type ChannelHealthTimingPolicy = {
monitorStartupGraceMs: number;
channelConnectGraceMs: number;
staleEventThresholdMs: number;
};
export type ChannelHealthMonitorDeps = {
channelManager: ChannelManager;
checkIntervalMs?: number; /** @deprecated use timing.monitorStartupGraceMs */
startupGraceMs?: number; /** @deprecated use timing.channelConnectGraceMs */
channelStartupGraceMs?: number; /** @deprecated use timing.staleEventThresholdMs */
staleEventThresholdMs?: number;
timing?: Partial<ChannelHealthTimingPolicy>;
cooldownCycles?: number;
maxRestartsPerHour?: number;
abortSignal?: AbortSignal;
};
export type ChannelHealthMonitor = {
stop: () => void;
};
type RestartRecord = {
lastRestartAt: number;
restartsThisHour: { at: number }[];
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.