adjust runtime.GOMAXPROCS to match the container CPU quota, if any

This commit is contained in:
Nicola Murino
2020-09-03 18:09:45 +02:00
parent a59163e56c
commit afc411c51b
3 changed files with 14 additions and 1 deletions

12
main.go
View File

@@ -3,8 +3,18 @@
// https://github.com/drakkan/sftpgo/blob/master/README.md
package main // import "github.com/drakkan/sftpgo"
import "github.com/drakkan/sftpgo/cmd"
import (
"fmt"
"go.uber.org/automaxprocs/maxprocs"
"github.com/drakkan/sftpgo/cmd"
)
func main() {
if undo, err := maxprocs.Set(); err != nil {
fmt.Printf("error setting max procs: %v\n", err)
undo()
}
cmd.Execute()
}