From 2b90f0a180171a778be5f85b5ac8fdabb8b31877 Mon Sep 17 00:00:00 2001 From: Mohit Gupta Date: Thu, 20 Mar 2014 15:58:06 -0700 Subject: [PATCH] set num of workers using command line params --- cmd/droned/drone.go | 7 ++++++- deb/drone/etc/default/drone | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/droned/drone.go b/cmd/droned/drone.go index c76a131a9..b31f688c6 100644 --- a/cmd/droned/drone.go +++ b/cmd/droned/drone.go @@ -49,6 +49,10 @@ var ( // commit sha for the current build. version string + + // Number of concurrent build workers to run + // default to number of CPUs on machine + workers int ) func main() { @@ -60,6 +64,7 @@ func main() { flag.StringVar(&sslcert, "sslcert", "", "") flag.StringVar(&sslkey, "sslkey", "", "") flag.DurationVar(&timeout, "timeout", 300*time.Minute, "") + flag.IntVar(&workers, "workers", runtime.NumCPU(), "") flag.Parse() // validate the TLS arguments @@ -135,7 +140,7 @@ func setupStatic() { // setup routes for serving dynamic content. func setupHandlers() { queueRunner := queue.NewBuildRunner(docker.New(), timeout) - queue := queue.Start(runtime.NumCPU(), queueRunner) + queue := queue.Start(workers, queueRunner) hookHandler := handler.NewHookHandler(queue) diff --git a/deb/drone/etc/default/drone b/deb/drone/etc/default/drone index 1eaa2679b..0e9e67321 100644 --- a/deb/drone/etc/default/drone +++ b/deb/drone/etc/default/drone @@ -6,5 +6,6 @@ # -driver="sqlite3": # -path="": # -port=":8080": +# -workers="4": # #DRONED_OPTS="--port=:80"