mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
added flag to set max workers
This commit is contained in:
parent
d6fc5998ee
commit
5bffef1e07
2 changed files with 7 additions and 3 deletions
|
@ -9,7 +9,8 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
const workerPoolSize = 8
|
||||
// WorkerPoolSize is the number of go routines used to parse routing tables concurrently
|
||||
var WorkerPoolSize = 8
|
||||
|
||||
var (
|
||||
ParserConf ParserConfig
|
||||
|
@ -225,9 +226,9 @@ func startRouteWorkers(jobs chan blockJob) chan blockParsed {
|
|||
out := make(chan blockParsed)
|
||||
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(workerPoolSize)
|
||||
wg.Add(WorkerPoolSize)
|
||||
go func() {
|
||||
for i := 0; i < workerPoolSize; i++ {
|
||||
for i := 0; i < WorkerPoolSize; i++ {
|
||||
go workerForRouteBlockParsing(jobs, out, wg)
|
||||
}
|
||||
wg.Wait()
|
||||
|
|
|
@ -107,9 +107,12 @@ func PrintServiceInfo(conf *Config, birdConf bird.BirdConfig) {
|
|||
|
||||
func main() {
|
||||
bird6 := flag.Bool("6", false, "Use bird6 instead of bird")
|
||||
workerPoolSize := flag.Int("worker-pool-size", 8, "Number of go routines used to parse routing tables concurrently")
|
||||
configfile := flag.String("config", "./etc/ecix/birdwatcher.conf", "Configuration file location")
|
||||
flag.Parse()
|
||||
|
||||
bird.WorkerPoolSize = *workerPoolSize
|
||||
|
||||
endpoints.VERSION = VERSION
|
||||
bird.InstallRateLimitReset()
|
||||
// Load configurations
|
||||
|
|
Loading…
Add table
Reference in a new issue