set num of workers using command line params
This commit is contained in:
parent
3b3da0424e
commit
2b90f0a180
2 changed files with 7 additions and 1 deletions
|
@ -49,6 +49,10 @@ var (
|
||||||
|
|
||||||
// commit sha for the current build.
|
// commit sha for the current build.
|
||||||
version string
|
version string
|
||||||
|
|
||||||
|
// Number of concurrent build workers to run
|
||||||
|
// default to number of CPUs on machine
|
||||||
|
workers int
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -60,6 +64,7 @@ func main() {
|
||||||
flag.StringVar(&sslcert, "sslcert", "", "")
|
flag.StringVar(&sslcert, "sslcert", "", "")
|
||||||
flag.StringVar(&sslkey, "sslkey", "", "")
|
flag.StringVar(&sslkey, "sslkey", "", "")
|
||||||
flag.DurationVar(&timeout, "timeout", 300*time.Minute, "")
|
flag.DurationVar(&timeout, "timeout", 300*time.Minute, "")
|
||||||
|
flag.IntVar(&workers, "workers", runtime.NumCPU(), "")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// validate the TLS arguments
|
// validate the TLS arguments
|
||||||
|
@ -135,7 +140,7 @@ func setupStatic() {
|
||||||
// setup routes for serving dynamic content.
|
// setup routes for serving dynamic content.
|
||||||
func setupHandlers() {
|
func setupHandlers() {
|
||||||
queueRunner := queue.NewBuildRunner(docker.New(), timeout)
|
queueRunner := queue.NewBuildRunner(docker.New(), timeout)
|
||||||
queue := queue.Start(runtime.NumCPU(), queueRunner)
|
queue := queue.Start(workers, queueRunner)
|
||||||
|
|
||||||
hookHandler := handler.NewHookHandler(queue)
|
hookHandler := handler.NewHookHandler(queue)
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
# -driver="sqlite3":
|
# -driver="sqlite3":
|
||||||
# -path="":
|
# -path="":
|
||||||
# -port=":8080":
|
# -port=":8080":
|
||||||
|
# -workers="4":
|
||||||
#
|
#
|
||||||
#DRONED_OPTS="--port=:80"
|
#DRONED_OPTS="--port=:80"
|
||||||
|
|
Loading…
Reference in a new issue