From 2aeb5e2c5a7e9cca91d5a3340f0ef5e4981a3c60 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Fri, 20 Jan 2023 11:30:43 -0800 Subject: [PATCH] Update snapshots to numCores and maxProcs after maxrocs.Set() Signed-off-by: Derek Collison --- main.go | 2 ++ server/monitor.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 767719fc..53652c6e 100644 --- a/main.go +++ b/main.go @@ -134,6 +134,8 @@ func main() { s.Warnf("Failed to set GOMAXPROCS: %v", err) } else { defer undo() + // Reset these from the snapshots from init for monitor.go + server.SnapshotMonitorInfo() } s.WaitForShutdown() diff --git a/server/monitor.go b/server/monitor.go index 62beb564..d2aadfc6 100644 --- a/server/monitor.go +++ b/server/monitor.go @@ -40,11 +40,15 @@ import ( var numCores int var maxProcs int -func init() { +func SnapshotMonitorInfo() { numCores = runtime.NumCPU() maxProcs = runtime.GOMAXPROCS(0) } +func init() { + SnapshotMonitorInfo() +} + // Connz represents detailed information on current client connections. type Connz struct { ID string `json:"server_id"`