Преглед изворни кода

make StartAutoCommit to control background routine

Thibault bui Koechlin пре 5 година
родитељ
комит
17a2722004
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      cmd/crowdsec/main.go

+ 5 - 0
cmd/crowdsec/main.go

@@ -14,6 +14,7 @@ import (
 	"github.com/crowdsecurity/crowdsec/pkg/outputs"
 	"github.com/crowdsecurity/crowdsec/pkg/outputs"
 	"github.com/crowdsecurity/crowdsec/pkg/parser"
 	"github.com/crowdsecurity/crowdsec/pkg/parser"
 	"github.com/crowdsecurity/crowdsec/pkg/types"
 	"github.com/crowdsecurity/crowdsec/pkg/types"
+	"github.com/pkg/errors"
 	"github.com/sevlyar/go-daemon"
 	"github.com/sevlyar/go-daemon"
 
 
 	log "github.com/sirupsen/logrus"
 	log "github.com/sirupsen/logrus"
@@ -163,6 +164,10 @@ func LoadOutputs(cConfig *csconfig.CrowdSec) error {
 		return fmt.Errorf("output plugins initialization error : %s", err.Error())
 		return fmt.Errorf("output plugins initialization error : %s", err.Error())
 	}
 	}
 
 
+	if err := OutputRunner.StartAutoCommit(); err != nil {
+		return errors.Wrap(err, "failed to start autocommit")
+	}
+
 	/* Init the API connector */
 	/* Init the API connector */
 	if cConfig.APIMode {
 	if cConfig.APIMode {
 		log.Infof("Loading API client")
 		log.Infof("Loading API client")