From 60b3f63851d1fcc6db0a2e5da1b1a570ee3b8549 Mon Sep 17 00:00:00 2001 From: Manuel Sabban Date: Tue, 28 Feb 2023 17:05:11 +0100 Subject: [PATCH] ugly workaround to fix the tests (#2080) * ugly workaround to fix the tests * add comments --------- Co-authored-by: sabban <15465465+sabban@users.noreply.github.com> --- cmd/crowdsec/serve.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/crowdsec/serve.go b/cmd/crowdsec/serve.go index db6401190..f3c053a63 100644 --- a/cmd/crowdsec/serve.go +++ b/cmd/crowdsec/serve.go @@ -196,6 +196,10 @@ func shutdown(sig os.Signal, cConfig *csconfig.Config) error { } func drainChan(c chan types.Event) { + time.Sleep(500 * time.Millisecond) + // delay to avoid draining chan before the acquisition/parser + // get a chance to push its event + // We should close the chan on the writer side rather than this for { select { case _, ok := <-c: