mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
concurrency uint8 to int (#2488)
* concurrency uint8 to uint16 * jk, use int * git test fix
This commit is contained in:
parent
5290023c2d
commit
bccba20d3e
3 changed files with 5 additions and 6 deletions
3
main.go
3
main.go
|
@ -405,7 +405,7 @@ func run(state overseer.State) {
|
|||
jobReportWriter = *jobReportFile
|
||||
}
|
||||
e, err := engine.Start(ctx,
|
||||
engine.WithConcurrency(uint8(*concurrency)),
|
||||
engine.WithConcurrency(*concurrency),
|
||||
engine.WithDecoders(decoders.DefaultDecoders()...),
|
||||
engine.WithDetectors(engine.DefaultDetectors()...),
|
||||
engine.WithDetectors(conf.Detectors...),
|
||||
|
@ -568,7 +568,6 @@ func run(state overseer.State) {
|
|||
if err = e.Finish(ctx); err != nil {
|
||||
logFatal(err, "engine failed to finish execution")
|
||||
}
|
||||
|
||||
if err := cleantemp.CleanTempArtifacts(ctx); err != nil {
|
||||
ctx.Logger().Error(err, "error cleaning temp artifacts")
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ type Printer interface {
|
|||
|
||||
type Engine struct {
|
||||
// CLI flags.
|
||||
concurrency uint8
|
||||
concurrency int
|
||||
decoders []decoders.Decoder
|
||||
detectors []detectors.Detector
|
||||
jobReportWriter io.WriteCloser
|
||||
|
@ -127,7 +127,7 @@ func WithJobReportWriter(w io.WriteCloser) Option {
|
|||
}
|
||||
}
|
||||
|
||||
func WithConcurrency(concurrency uint8) Option {
|
||||
func WithConcurrency(concurrency int) Option {
|
||||
return func(e *Engine) {
|
||||
e.concurrency = concurrency
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ func (e *Engine) setDefaults(ctx context.Context) {
|
|||
if e.concurrency == 0 {
|
||||
numCPU := runtime.NumCPU()
|
||||
ctx.Logger().Info("No concurrency specified, defaulting to max", "cpu", numCPU)
|
||||
e.concurrency = uint8(numCPU)
|
||||
e.concurrency = numCPU
|
||||
}
|
||||
ctx.Logger().V(3).Info("engine started", "workers", e.concurrency)
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ func BenchmarkGitEngine(b *testing.B) {
|
|||
defer cancel()
|
||||
|
||||
e, err := Start(ctx,
|
||||
WithConcurrency(uint8(runtime.NumCPU())),
|
||||
WithConcurrency(runtime.NumCPU()),
|
||||
WithDecoders(decoders.DefaultDecoders()...),
|
||||
WithDetectors(DefaultDetectors()...),
|
||||
WithVerify(false),
|
||||
|
|
Loading…
Reference in a new issue