From 8c730955484bad381ba3ebe0ab366f4924db098d Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Wed, 20 Apr 2022 09:58:02 +0200 Subject: [PATCH] Allow to shutdown redfish receiver during metric read --- receivers/redfishReceiver.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/receivers/redfishReceiver.go b/receivers/redfishReceiver.go index 358093d..bcf857e 100644 --- a/receivers/redfishReceiver.go +++ b/receivers/redfishReceiver.go @@ -146,7 +146,17 @@ func (r *RedfishReceiver) Start() { } // Distribute client configs to workers + clientConfigLoop: for i := range r.config.ClientConfigs { + // Check done channel status + select { + case _, ok := <-r.done: + if !ok { + break clientConfigLoop + } + default: + } + workerInput <- i }