Skip to content

Commit 8e8093b

Browse files
authored
Merge pull request gocolly#864 from stemlaud/master
refactor: use the built-in max to simplify the code
2 parents 8fabdcf + 4829951 commit 8e8093b

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)