Clean up to match olm

This commit is contained in:
Owen
2026-03-14 11:57:37 -07:00
parent 745d2dbc7e
commit bf029b7bb2

View File

@@ -661,15 +661,7 @@ func (c *Client) setupPKCS12TLS() (*tls.Config, error) {
}
// pingMonitor sends pings at a short interval and triggers reconnect on failure
func (c *Client) pingMonitor() {
ticker := time.NewTicker(c.pingInterval)
defer ticker.Stop()
for {
select {
case <-c.done:
return
case <-ticker.C:
func (c *Client) sendPing() {
if c.conn == nil {
return
}
@@ -680,7 +672,7 @@ func (c *Client) pingMonitor() {
c.processingMux.RUnlock()
if isProcessing {
logger.Debug("Skipping ping, message is being processed")
continue
return
}
c.configVersionMux.RLock()
@@ -714,6 +706,21 @@ func (c *Client) pingMonitor() {
return
}
}
}
func (c *Client) pingMonitor() {
// Send an immediate ping as soon as we connect
c.sendPing()
ticker := time.NewTicker(c.pingInterval)
defer ticker.Stop()
for {
select {
case <-c.done:
return
case <-ticker.C:
c.sendPing()
}
}
}