()
| 131 | } |
| 132 | |
| 133 | func (cm *ConnMonitor) checkConnection() { |
| 134 | lastActivity := cm.LastActivityTime.Load() |
| 135 | if lastActivity == 0 { |
| 136 | return |
| 137 | } |
| 138 | urgent := cm.isUrgent() |
| 139 | timeSinceActivity := time.Now().UnixMilli() - lastActivity |
| 140 | |
| 141 | keepAliveThreshold := int64(10000) |
| 142 | if urgent { |
| 143 | keepAliveThreshold = 1000 |
| 144 | } |
| 145 | if timeSinceActivity > keepAliveThreshold { |
| 146 | cm.SendKeepAlive() |
| 147 | } |
| 148 | |
| 149 | stalledThreshold := int64(10000) |
| 150 | if urgent { |
| 151 | stalledThreshold = 5000 |
| 152 | } |
| 153 | timeSinceKeepAlive := cm.getTimeSinceKeepAlive() |
| 154 | if timeSinceKeepAlive > stalledThreshold { |
| 155 | cm.setConnHealthStatus(ConnHealthStatus_Stalled) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func (cm *ConnMonitor) keepAliveMonitor() { |
| 160 | defer func() { |
no test coverage detected