concurrency uint8 to int (#2488)

* concurrency uint8 to uint16

* jk, use int

* git test fix
This commit is contained in:
Zachary Rice 2024-02-20 09:35:40 -06:00 committed by GitHub
parent 5290023c2d
commit bccba20d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 6 deletions

View file

@ -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")
}

View file

@ -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)

View file

@ -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),