Skip to content

Commit 8c9ad65

Browse files
author
Hayim.Shaul@ibm.com
committed
format
Signed-off-by: Hayim.Shaul@ibm.com <hayimsha@fhe03.vpc.cloud9.ibm.com>
1 parent 142170c commit 8c9ad65

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

token/services/selector/config/driver.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ const (
2424
defaultFetcherCacheMaxQueries = 0 // 0 means use fetcher default
2525

2626
// Security limits to prevent algorithmic attacks
27-
defaultMaxTokensPerSelection = 10000 // Max tokens to iterate per selection
28-
defaultMaxLockAttempts = 50000 // Max lock attempts per selection (5x iteration limit)
29-
defaultMaxRetryCycles = 10 // Max outer retry loops
30-
defaultMaxLocksPerTransaction = 5000 // Max concurrent locks held per transaction
31-
defaultSelectionTimeout = 30 * time.Second // Wall-clock timeout for selection
27+
defaultMaxTokensPerSelection = 10000 // Max tokens to iterate per selection
28+
defaultMaxLockAttempts = 50000 // Max lock attempts per selection (5x iteration limit)
29+
defaultMaxRetryCycles = 10 // Max outer retry loops
30+
defaultMaxLocksPerTransaction = 5000 // Max concurrent locks held per transaction
31+
defaultSelectionTimeout = 30 * time.Second // Wall-clock timeout for selection
3232
)
3333

3434
//go:generate counterfeiter -o mock/config_service.go -fake-name ConfigService . configService

token/services/selector/simple/manager.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ type Manager struct {
2424
precision uint64
2525

2626
// Resource limits
27-
maxTokensPerSelection int
28-
maxLockAttempts int
29-
maxRetryCycles int
30-
selectionTimeout time.Duration
27+
maxTokensPerSelection int
28+
maxLockAttempts int
29+
maxRetryCycles int
30+
selectionTimeout time.Duration
3131
}
3232

3333
func NewManager(
@@ -43,16 +43,16 @@ func NewManager(
4343
selectionTimeout time.Duration,
4444
) *Manager {
4545
return &Manager{
46-
locker: locker,
47-
newQueryEngine: newQueryEngine,
48-
numRetry: numRetry,
49-
timeout: timeout,
50-
requestCertification: requestCertification,
51-
precision: precision,
52-
maxTokensPerSelection: maxTokensPerSelection,
53-
maxLockAttempts: maxLockAttempts,
54-
maxRetryCycles: maxRetryCycles,
55-
selectionTimeout: selectionTimeout,
46+
locker: locker,
47+
newQueryEngine: newQueryEngine,
48+
numRetry: numRetry,
49+
timeout: timeout,
50+
requestCertification: requestCertification,
51+
precision: precision,
52+
maxTokensPerSelection: maxTokensPerSelection,
53+
maxLockAttempts: maxLockAttempts,
54+
maxRetryCycles: maxRetryCycles,
55+
selectionTimeout: selectionTimeout,
5656
}
5757
}
5858

token/services/selector/simple/selector.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ type selector struct {
4242
requestCertification bool
4343

4444
// Resource limits to prevent algorithmic attacks
45-
maxTokensPerSelection int
46-
maxLockAttempts int
47-
maxRetryCycles int
48-
selectionTimeout time.Duration
45+
maxTokensPerSelection int
46+
maxLockAttempts int
47+
maxRetryCycles int
48+
selectionTimeout time.Duration
4949

5050
// Resource tracking counters (reset per selection)
5151
tokensIteratedCount int

0 commit comments

Comments
 (0)