Skip to content

Commit

Permalink
ugly workaround to fix the tests (crowdsecurity#2080)
Browse files Browse the repository at this point in the history
* ugly workaround to fix the tests

* add comments

---------

Co-authored-by: sabban <[email protected]>
  • Loading branch information
sabban and sabban authored Feb 28, 2023
1 parent 39a4a25 commit 60b3f63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/crowdsec/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 60b3f63

Please sign in to comment.