Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/healthcheck/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ func (hc *HealthChecker) checkMCPStatus(ctx context.Context) *MCPStatus {
LastChecked: time.Now(),
}

// Create a context with timeout for the ping
pingCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()

duration, err := hc.mcpPinger.Ping(pingCtx)
duration, err := hc.mcpPinger.Ping(ctx)

if err != nil {
status.Available = false
Expand Down
14 changes: 3 additions & 11 deletions pkg/transport/proxy/transparent/transparent_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,10 @@ func NewTransparentProxyWithOptions(
// Create health checker always for Kubernetes probes
var mcpPinger healthcheck.MCPPinger
if enableHealthCheck {
pingTimeout := proxy.healthCheckPingTimeout
if pingTimeout == 0 {
pingTimeout = DefaultPingerTimeout
}
if proxy.stateless {
mcpPinger = NewStatelessMCPPingerWithTimeout(targetURI, pingTimeout)
mcpPinger = NewStatelessMCPPingerWithTimeout(targetURI, proxy.healthCheckPingTimeout)
} else {
mcpPinger = NewMCPPingerWithTimeout(targetURI, pingTimeout)
mcpPinger = NewMCPPingerWithTimeout(targetURI, proxy.healthCheckPingTimeout)
}
}
proxy.healthChecker = healthcheck.NewHealthChecker(transportType, mcpPinger)
Expand Down Expand Up @@ -1246,11 +1242,7 @@ func (p *TransparentProxy) handleHealthCheckFailure(
}

func (p *TransparentProxy) monitorHealth(parentCtx context.Context) {
interval := p.healthCheckInterval
if interval == 0 {
interval = DefaultHealthCheckInterval
}
ticker := time.NewTicker(interval)
ticker := time.NewTicker(p.healthCheckInterval)
defer ticker.Stop()

consecutiveFailures := 0
Expand Down
Loading