Extended go routine use case in sample receiver

This commit is contained in:
Holger Obermaier 2022-04-19 11:42:46 +02:00
parent 017cd58247
commit e7b8088c41

View File

@ -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() {
// defer r.wg.Done()
//
// // Create ticker
// ticker := time.NewTicker(30 * time.Second)
// defer ticker.Stop()
//
// for { // for {
// readMetric()
// select { // select {
// case <-ticker.C:
// // process ticker event -> continue
// continue
// case <-r.done: // case <-r.done:
// r.wg.Done()
// return // return
// } // }
// } // }
// r.wg.Done()
// }() // }()
} }