don't wait on tomb if no datasources were started (#1019)

This commit is contained in:
Thibault "bui" Koechlin 2021-10-24 11:07:45 +02:00 committed by GitHub
parent 3f99330b3d
commit 76a80380e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,11 +104,13 @@ func ShutdownCrowdsecRoutines() error {
var reterr error
log.Debugf("Shutting down crowdsec sub-routines")
acquisTomb.Kill(nil)
log.Debugf("waiting for acquisition to finish")
if err := acquisTomb.Wait(); err != nil {
log.Warningf("Acquisition returned error : %s", err)
reterr = err
if len(dataSources) > 0 {
acquisTomb.Kill(nil)
log.Debugf("waiting for acquisition to finish")
if err := acquisTomb.Wait(); err != nil {
log.Warningf("Acquisition returned error : %s", err)
reterr = err
}
}
log.Debugf("acquisition is finished, wait for parser/bucket/ouputs.")
parsersTomb.Kill(nil)