proxy-detector/pkg/worker/pool.go

17 lines
315 B
Go

package worker
import (
"github.com/panjf2000/ants/v2"
log "github.com/sirupsen/logrus"
)
var Pool *ants.Pool
func Init(goroutines int) {
var err error
Pool, err = ants.NewPool(goroutines, ants.WithMaxBlockingTasks(goroutines))
if err != nil {
log.Fatalf("create worker pool error: %s", err.Error())
}
}