Skip to content

Commit 5709c4c

Browse files
committed
fix: address review feedback — reduce concurrency limit, fix copyright
- Change default concurrency from max(NumCPU*2, 10) to max(NumCPU, 5) to avoid contention on remote state optimistic locking and limit pressure on AI-enabled policies (per migmartri and jiparis feedback) - Fix copyright year in concurrency_test.go Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
1 parent 6d2ea3e commit 5709c4c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/policies/concurrency_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2024-2026 The Chainloop Authors.
2+
// Copyright 2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

pkg/policies/policies.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ const (
7575
)
7676

7777
// defaultMaxConcurrency is the default number of concurrent policy evaluations.
78-
// Set higher than NumCPU because policy evaluation is I/O-mixed (gRPC calls,
79-
// file loads) rather than purely CPU-bound. Can be overridden via WithMaxConcurrency.
80-
var defaultMaxConcurrency = max(runtime.NumCPU()*2, 10)
78+
// Kept conservative to avoid contention on remote state optimistic locking
79+
// and to limit pressure on AI-enabled policies. Can be overridden via WithMaxConcurrency.
80+
var defaultMaxConcurrency = max(runtime.NumCPU(), 5)
8181

8282
type PolicyVerifier struct {
8383
policies *v1.Policies

0 commit comments

Comments
 (0)