mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-11-25 01:43:23 +00:00
refactor resource limit function
This commit is contained in:
parent
82a45048f5
commit
0ab753bb2c
@ -17,7 +17,7 @@ var (
|
|||||||
goroutineQueueMutex sync.Mutex
|
goroutineQueueMutex sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
func ApplyResourceLimits(cfg *configTypes.ResourceLimits) {
|
func SetResourceLimit(cfg *configTypes.ResourceLimits) {
|
||||||
// Set CPU cores
|
// Set CPU cores
|
||||||
runtime.GOMAXPROCS(cfg.CPUCores)
|
runtime.GOMAXPROCS(cfg.CPUCores)
|
||||||
|
|
2
main.go
2
main.go
@ -39,7 +39,7 @@ func main() {
|
|||||||
log.Fatal("Error loading config: ", err)
|
log.Fatal("Error loading config: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
config.ApplyResourceLimits(&cfg.ResourceLimits) // Apply limits once before starting the server
|
config.SetResourceLimit(&cfg.ResourceLimits) // Apply limits once before starting the server
|
||||||
|
|
||||||
client, err := db.InitDB(cfg)
|
client, err := db.InitDB(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user