From 0fd57d134d32a99f011535dbd7232c46a7e326de Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Fri, 10 Jul 2020 11:43:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Detect=20Child=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: kiyon Co-Authored-By: Nathaniel Peiffer --- prefork.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/prefork.go b/prefork.go index 82f89ce2..0d2f8f4e 100644 --- a/prefork.go +++ b/prefork.go @@ -29,16 +29,15 @@ func init() { //nolint:gochecknoinits flag.Usage = usage } -// Child determines if the current environment is a child process -// This method can be usefull when Prefork is enabled. -func (app *App) Child() bool { +// IsChild determines if the current process is a result of Prefork +func (app *App) IsChild() bool { return utils.GetArgument(flagChild) } // prefork manages child processes to make use of the OS REUSEPORT or REUSEADDR feature func (app *App) prefork(addr string, tlsconfig ...*tls.Config) (err error) { // 👶 child process 👶 - if app.Child() { + if app.IsChild() { // use 1 cpu core per child process runtime.GOMAXPROCS(1) var ln net.Listener