Skip to content

Commit 0191bb5

Browse files
authored
chore: replace 1<<31-1 with math.MaxInt32 (#392)
1 parent 4782ebe commit 0191bb5

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

multipool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (mp *MultiPool) next(lbs LoadBalancingStrategy) (idx int) {
124124
case RoundRobin:
125125
return int(atomic.AddUint32(&mp.index, 1) % uint32(len(mp.pools)))
126126
case LeastTasks:
127-
leastTasks := 1<<31 - 1
127+
leastTasks := math.MaxInt32
128128
for i, pool := range mp.pools {
129129
if n := pool.Running(); n < leastTasks {
130130
leastTasks = n

multipool_func.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (mp *MultiPoolWithFunc) next(lbs LoadBalancingStrategy) (idx int) {
7171
case RoundRobin:
7272
return int(atomic.AddUint32(&mp.index, 1) % uint32(len(mp.pools)))
7373
case LeastTasks:
74-
leastTasks := 1<<31 - 1
74+
leastTasks := math.MaxInt32
7575
for i, pool := range mp.pools {
7676
if n := pool.Running(); n < leastTasks {
7777
leastTasks = n

multipool_func_generic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (mp *MultiPoolWithFuncGeneric[T]) next(lbs LoadBalancingStrategy) (idx int)
6767
case RoundRobin:
6868
return int(atomic.AddUint32(&mp.index, 1) % uint32(len(mp.pools)))
6969
case LeastTasks:
70-
leastTasks := 1<<31 - 1
70+
leastTasks := math.MaxInt32
7171
for i, pool := range mp.pools {
7272
if n := pool.Running(); n < leastTasks {
7373
leastTasks = n

0 commit comments

Comments
 (0)