audit/kafka: Fix quitting early after first logging (#14932)

A recent commit created some regressions:
- Kafka/Audit goroutines quit when the first log is sent
- Missing doneCh initialization in Kafka audit
This commit is contained in:
Anis Elleuch
2022-05-17 15:43:25 +01:00
committed by GitHub
parent 040ac5cad8
commit e952e2a691
2 changed files with 15 additions and 10 deletions

View File

@@ -179,11 +179,13 @@ func (h *Target) startHTTPLogger() {
go func() {
defer h.wg.Done()
select {
case entry := <-h.logCh:
h.logEntry(entry)
case <-h.doneCh:
return
for {
select {
case entry := <-h.logCh:
h.logEntry(entry)
case <-h.doneCh:
return
}
}
}()
}