Commit dd4fb1d6 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/plugin: Explicitly set GOMAXPROCS to # of cpus

parent aefb947f
...@@ -16,6 +16,7 @@ import ( ...@@ -16,6 +16,7 @@ import (
"net/rpc" "net/rpc"
"os" "os"
"os/signal" "os/signal"
"runtime"
"strconv" "strconv"
"strings" "strings"
) )
...@@ -23,6 +24,11 @@ import ( ...@@ -23,6 +24,11 @@ import (
// This serves a single RPC connection on the given RPC server on // This serves a single RPC connection on the given RPC server on
// a random port. // a random port.
func serve(server *rpc.Server) (err error) { func serve(server *rpc.Server) (err error) {
// If there is no explicit number of Go threads to use, then set it
if os.Getenv("GOMAXPROCS") == "" {
runtime.GOMAXPROCS(runtime.NumCPU())
}
minPort, err := strconv.ParseInt(os.Getenv("PACKER_PLUGIN_MIN_PORT"), 10, 32) minPort, err := strconv.ParseInt(os.Getenv("PACKER_PLUGIN_MIN_PORT"), 10, 32)
if err != nil { if err != nil {
return return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment