diff --git a/pkg/leakybucket/bucket.go b/pkg/leakybucket/bucket.go index 48e5a4868..02a03a5c9 100644 --- a/pkg/leakybucket/bucket.go +++ b/pkg/leakybucket/bucket.go @@ -9,7 +9,6 @@ import ( //"log" "github.com/crowdsecurity/crowdsec/pkg/time/rate" "github.com/crowdsecurity/crowdsec/pkg/types" - "github.com/goombaio/namegenerator" "gopkg.in/tomb.v2" //rate "time/rate" @@ -158,7 +157,7 @@ func FromFactory(bucketFactory BucketFactory) *Leaky { l := &Leaky{ Name: bucketFactory.Name, Limiter: limiter, - Uuid: namegenerator.NewNameGenerator(time.Now().UTC().UnixNano()).Generate(), + Uuid: seed.Generate(), Queue: NewQueue(Qsize), CacheSize: bucketFactory.CacheSize, Out: make(chan *Queue, 1), diff --git a/pkg/leakybucket/manager_load.go b/pkg/leakybucket/manager_load.go index 759247c6f..c7b23c872 100644 --- a/pkg/leakybucket/manager_load.go +++ b/pkg/leakybucket/manager_load.go @@ -74,6 +74,9 @@ type BucketFactory struct { wgDumpState *sync.WaitGroup `yaml:"-"` } +//we use one NameGenerator for all the future buckets +var seed namegenerator.Generator = namegenerator.NewNameGenerator(time.Now().UTC().UnixNano()) + func ValidateFactory(bucketFactory *BucketFactory) error { if bucketFactory.Name == "" { return fmt.Errorf("bucket must have name") @@ -147,8 +150,6 @@ func LoadBuckets(cscfg *csconfig.CrowdsecServiceCfg, files []string, tomb *tomb. response chan types.Event ) - var seed namegenerator.Generator = namegenerator.NewNameGenerator(time.Now().UTC().UnixNano()) - response = make(chan types.Event, 1) for _, f := range files { log.Debugf("Loading '%s'", f)