MCPcopy Create free account
hub / github.com/evenh/intercert / configureTermination

Function configureTermination

client/client.go:81–103  ·  view source on GitHub ↗
(backgroundJobs []Job)

Source from the content-addressed store, hash-verified

79}
80
81func configureTermination(backgroundJobs []Job) {
82 var gracefulStop = make(chan os.Signal)
83
84 signal.Notify(gracefulStop, syscall.SIGTERM)
85 signal.Notify(gracefulStop, syscall.SIGINT)
86
87 go func() {
88 sig := <-gracefulStop
89 log.Infof("Caught signal: %+v", sig)
90 log.Infof("Waiting for background tasks to exit...")
91
92 // Tell all background jobs to exit
93 for i := range backgroundJobs {
94 backgroundJobs[i].Stop()
95 }
96
97 // Wait for completion of background jobs
98 for !IsJobsStopped(backgroundJobs) {
99 }
100
101 os.Exit(0)
102 }()
103}
104
105func validateConfig(c *config.ClientConfig) error {
106 if len(c.Domains) < 1 {

Callers 1

StartClientFunction · 0.85

Calls 2

IsJobsStoppedFunction · 0.85
StopMethod · 0.80

Tested by

no test coverage detected