mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* [NOD-1420] Moved setting limits to executor * [NOD-1420] Moved all code dealing with windows service to separate package * [NOD-1420] Move practically all main to restructured app package * [NOD-1420] Check for running as interactive only after checking if we are doing any service operation * [NOD-1420] Add comments * [NOD-1420] Add a comment
23 lines
463 B
Go
23 lines
463 B
Go
package execenv
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
|
|
"github.com/kaspanet/kaspad/infrastructure/os/limits"
|
|
)
|
|
|
|
// Initialize initializes the execution environment required to run kaspad
|
|
func Initialize(desiredLimits *limits.DesiredLimits) {
|
|
// Use all processor cores.
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
|
|
// Up some limits.
|
|
if err := limits.SetLimits(desiredLimits); err != nil {
|
|
fmt.Fprintf(os.Stderr, "failed to set limits: %s\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
}
|