Skip to content

Commit

Permalink
Add a flag for the number of workers to process the queue
Browse files Browse the repository at this point in the history
  • Loading branch information
FTWynn committed Feb 15, 2016
1 parent e7c162d commit 6f6e403
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

var confPath string
var workers int

// GlobalConfStore holds all the config data from the conf file
type GlobalConfStore struct {
Expand Down Expand Up @@ -57,8 +58,9 @@ type LogGenDataFile struct {
func init() {
// Set global logging levels by the flag, default to WARN if not defined
var level string
flag.StringVar(&level, "level", "WARN", "a string")
flag.StringVar(&confPath, "conf", "config/gologgen.conf", "a string")
flag.StringVar(&level, "level", "WARN", "Log level for the gologgen program itself")
flag.StringVar(&confPath, "conf", "config/gologgen.conf", "Optional path for the config file")
flag.IntVar(&workers, "workers", 10, "Number of workers to spawn for queue processing")

flag.Parse()

Expand Down Expand Up @@ -517,7 +519,7 @@ func main() {
runQueue := make(chan loggensender.LogLineProperties)

//Spawn worker pool to keep the queue processing
for w := 1; w < 10; w++ {
for w := 1; w < workers; w++ {
go loggensender.RunLogLine(runQueue)
}

Expand Down

0 comments on commit 6f6e403

Please sign in to comment.