Closed jonny-mark closed 2 years ago
func (rs *RabbitService) collectConsumerErrors() { MonitorLoop: for { for _, consumer := range rs.consumers { IndividualConsumerLoop: for { if rs.shutdown { break MonitorLoop // Prevent leaking goroutine } select { case err := <-consumer.Errors(): rs.centralErr <- err default: break IndividualConsumerLoop } } } time.Sleep(rs.monitorSleepInterval) } }
------it could be like this-----
func (rs *RabbitService) collectConsumerErrors() { MonitorLoop: for { IndividualConsumerLoop: for _, consumer := range rs.consumers { for { if rs.shutdown { break MonitorLoop // Prevent leaking goroutine } select { case err := <-consumer.Errors(): rs.centralErr <- err default: break IndividualConsumerLoop } } } time.Sleep(rs.monitorSleepInterval) } }
------it could be like this-----