Skip to content

Commit 33a26bd

Browse files
changed blocking channel send to non-blocking (#766)
1 parent 327b0b6 commit 33a26bd

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

cns/service/main.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,25 +669,43 @@ func main() {
669669
}
670670

671671
if !disableTelemetry {
672-
telemetryStopProcessing <- true
673-
stopheartbeat <- true
674-
stopSnapshots <- true
672+
logger.Printf("stopping telemetry service thread")
673+
select {
674+
case telemetryStopProcessing <- true:
675+
default:
676+
}
677+
678+
logger.Printf("stop heartbeat thread")
679+
select {
680+
case stopheartbeat <- true:
681+
default:
682+
}
683+
684+
logger.Printf("stop snapshot thread")
685+
select {
686+
case stopSnapshots <- true:
687+
default:
688+
}
675689
}
676690

691+
logger.Printf("stop cns service")
677692
// Cleanup.
678693
if httpRestService != nil {
679694
httpRestService.Stop()
680695
}
681696

682697
if startCNM {
698+
logger.Printf("stop cnm plugin")
683699
if netPlugin != nil {
684700
netPlugin.Stop()
685701
}
686702

687703
if ipamPlugin != nil {
704+
logger.Printf("stop ipam plugin")
688705
ipamPlugin.Stop()
689706
}
690707
}
691708

709+
logger.Printf("CNS exited")
692710
logger.Close()
693711
}

0 commit comments

Comments
 (0)