File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,14 +92,17 @@ function getChannelHealth(channel) {
9292 if ( neg2Count > 0 && lastNeg2 !== null && lastNeg2 < 60 * 60 * 1000 ) {
9393 return { health : 'yellow' , reason : `最近 ${ Math . round ( lastNeg2 / 60000 ) } 分钟内出现 ${ neg2Count } 次 ret:-2` , details } ;
9494 }
95- if ( lastSendOk !== null && lastSendOk > 4 * 60 * 60 * 1000 ) {
96- return { health : 'yellow' , reason : `${ Math . round ( lastSendOk / 60000 ) } 分钟未推送成功(poller 仍活)` , details } ;
95+ // "长时间无成功推送"判黄之前,先给"用户最近回复过"一个豁免:
96+ // 用户回复会刷新 context_token,24h 内回过就不算异常(低流量用户不应被持续判黄)
97+ const inboundFresh = lastInbound !== null && lastInbound < 24 * 60 * 60 * 1000 ;
98+ if ( lastSendOk !== null && lastSendOk > 4 * 60 * 60 * 1000 && ! inboundFresh ) {
99+ return { health : 'yellow' , reason : `${ Math . round ( lastSendOk / 60000 ) } 分钟未推送成功,用户也长时间未回复` , details } ;
97100 }
98- if ( lastSendOk === null && dbStatus === 'active' ) {
99- return { health : 'yellow' , reason : '通道激活后尚无成功推送记录' , details } ;
101+ if ( lastSendOk === null && dbStatus === 'active' && ! inboundFresh ) {
102+ return { health : 'yellow' , reason : '通道激活后尚无成功推送记录,用户也未回复过 ' , details } ;
100103 }
101104
102- // 绿:poller 活 + 近期(4h 内)有成功推送 + 无最近 ret:-2
105+ // 绿:(4h 内成功推送 OR 24h 内用户回复过) + poller 活 + 无最近 ret:-2
103106 return { health : 'green' , reason : '正常' , details } ;
104107}
105108
You can’t perform that action at this time.
0 commit comments