File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export function startChannelHealthMonitor(deps: ChannelHealthMonitorDeps): Chann
122122 continue ;
123123 }
124124 const healthPolicy : ChannelHealthPolicy = {
125+ channelId,
125126 now,
126127 staleEventThresholdMs : timing . staleEventThresholdMs ,
127128 channelConnectGraceMs : timing . channelConnectGraceMs ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export type ChannelHealthEvaluation = {
2828} ;
2929
3030export type ChannelHealthPolicy = {
31+ channelId ?: string ;
3132 now : number ;
3233 staleEventThresholdMs : number ;
3334 channelConnectGraceMs : number ;
@@ -97,6 +98,11 @@ export function evaluateChannelHealth(
9798 if ( snapshot . connected === false ) {
9899 return { healthy : false , reason : "disconnected" } ;
99100 }
101+ // Skip stale-socket check for Telegram (long-polling mode). Each polling request
102+ // acts as a heartbeat, so the half-dead WebSocket scenario this check is designed
103+ // to catch does not apply to Telegram's long-polling architecture.
104+ if ( policy . channelId !== "telegram" ) {
105+
100106 if ( snapshot . lastEventAt != null || snapshot . lastStartAt != null ) {
101107 const upSince = snapshot . lastStartAt ?? 0 ;
102108 const upDuration = policy . now - upSince ;
@@ -108,6 +114,7 @@ export function evaluateChannelHealth(
108114 }
109115 }
110116 }
117+ }
111118 return { healthy : true , reason : "healthy" } ;
112119}
113120
Original file line number Diff line number Diff line change @@ -50,17 +50,18 @@ export function createReadinessChecker(deps: {
5050
5151 const snapshot = channelManager . getRuntimeSnapshot ( ) ;
5252 const failing : string [ ] = [ ] ;
53- const policy : ChannelHealthPolicy = {
54- now,
55- staleEventThresholdMs : DEFAULT_CHANNEL_STALE_EVENT_THRESHOLD_MS ,
56- channelConnectGraceMs : DEFAULT_CHANNEL_CONNECT_GRACE_MS ,
57- } ;
5853
5954 for ( const [ channelId , accounts ] of Object . entries ( snapshot . channelAccounts ) ) {
6055 if ( ! accounts ) {
6156 continue ;
6257 }
6358 for ( const accountSnapshot of Object . values ( accounts ) ) {
59+ const policy : ChannelHealthPolicy = {
60+ now,
61+ staleEventThresholdMs : DEFAULT_CHANNEL_STALE_EVENT_THRESHOLD_MS ,
62+ channelConnectGraceMs : DEFAULT_CHANNEL_CONNECT_GRACE_MS ,
63+ channelId,
64+ } ;
6465 if ( ! accountSnapshot ) {
6566 continue ;
6667 }
You can’t perform that action at this time.
0 commit comments