From 66d2962ec2dd74af3a6b4384fdbc6630247880da Mon Sep 17 00:00:00 2001 From: Tamilmani Manoharan Date: Fri, 15 Jan 2021 18:52:27 -0800 Subject: [PATCH] changed blocking channel send to non-blocking --- cns/service/main.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/cns/service/main.go b/cns/service/main.go index bd4b6a9d66..3657a578a6 100644 --- a/cns/service/main.go +++ b/cns/service/main.go @@ -669,25 +669,43 @@ func main() { } if !disableTelemetry { - telemetryStopProcessing <- true - stopheartbeat <- true - stopSnapshots <- true + logger.Printf("stopping telemetry service thread") + select { + case telemetryStopProcessing <- true: + default: + } + + logger.Printf("stop heartbeat thread") + select { + case stopheartbeat <- true: + default: + } + + logger.Printf("stop snapshot thread") + select { + case stopSnapshots <- true: + default: + } } + logger.Printf("stop cns service") // Cleanup. if httpRestService != nil { httpRestService.Stop() } if startCNM { + logger.Printf("stop cnm plugin") if netPlugin != nil { netPlugin.Stop() } if ipamPlugin != nil { + logger.Printf("stop ipam plugin") ipamPlugin.Stop() } } + logger.Printf("CNS exited") logger.Close() }