mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Extended go routine use case in sample receiver
This commit is contained in:
parent
017cd58247
commit
e7b8088c41
@ -36,16 +36,26 @@ func (r *SampleReceiver) Start() {
|
|||||||
|
|
||||||
// or use own go routine but always make sure it exits
|
// or use own go routine but always make sure it exits
|
||||||
// as soon as it gets the signal of the r.done channel
|
// as soon as it gets the signal of the r.done channel
|
||||||
|
//
|
||||||
|
// r.done = make(chan bool)
|
||||||
// r.wg.Add(1)
|
// r.wg.Add(1)
|
||||||
// go func() {
|
// go func() {
|
||||||
// for {
|
// defer r.wg.Done()
|
||||||
// select {
|
//
|
||||||
// case <-r.done:
|
// // Create ticker
|
||||||
// r.wg.Done()
|
// ticker := time.NewTicker(30 * time.Second)
|
||||||
// return
|
// defer ticker.Stop()
|
||||||
// }
|
//
|
||||||
// }
|
// for {
|
||||||
// r.wg.Done()
|
// readMetric()
|
||||||
|
// select {
|
||||||
|
// case <-ticker.C:
|
||||||
|
// // process ticker event -> continue
|
||||||
|
// continue
|
||||||
|
// case <-r.done:
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// }()
|
// }()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user