Skip to content

Commit 4829951

Browse files
committed
refactor: use the built-in max to simplify the code
Signed-off-by: stemlaud <[email protected]>
1 parent 1ce3469 commit 4829951

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

http_backend.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ type LimitRule struct {
6666

6767
// Init initializes the private members of LimitRule
6868
func (r *LimitRule) Init() error {
69-
waitChanSize := 1
70-
if r.Parallelism > 1 {
71-
waitChanSize = r.Parallelism
72-
}
73-
r.waitChan = make(chan bool, waitChanSize)
69+
r.waitChan = make(chan bool, max(r.Parallelism, 1))
7470
hasPattern := false
7571
if r.DomainRegexp != "" {
7672
c, err := regexp.Compile(r.DomainRegexp)

0 commit comments

Comments
 (0)