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 // pingMonitor sends pings at a short interval and triggers reconnect on failure
func (c *Client) pingMonitor() { func (c *Client) sendPing() {
ticker := time.NewTicker(c.pingInterval)
defer ticker.Stop()
for {
select {
case <-c.done:
return
case <-ticker.C:
if c.conn == nil { if c.conn == nil {
return return
} }
@@ -680,7 +672,7 @@ func (c *Client) pingMonitor() {
c.processingMux.RUnlock() c.processingMux.RUnlock()
if isProcessing { if isProcessing {
logger.Debug("Skipping ping, message is being processed") logger.Debug("Skipping ping, message is being processed")
continue return
} }
c.configVersionMux.RLock() c.configVersionMux.RLock()
@@ -714,6 +706,21 @@ func (c *Client) pingMonitor() {
return 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()
} }
} }
} }