From 1ae9288d593d94f229054c78345a3b424a24c192 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Tue, 16 Jan 2024 15:35:05 -0800 Subject: [PATCH] update cpu check log (#587) --- pkg/stats/monitor.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pkg/stats/monitor.go b/pkg/stats/monitor.go index fa7e3ce3..008c928f 100644 --- a/pkg/stats/monitor.go +++ b/pkg/stats/monitor.go @@ -300,24 +300,27 @@ func (m *Monitor) canAcceptRequestLocked(req *rpc.StartEgressRequest) bool { available = total - used - (total * (1 - m.cpuCostConfig.MaxCpuUtilization)) } - logger.Debugw("cpu check", - "total", total, - "available", available, - "active_requests", m.requests, - ) - + var required float64 switch req.Request.(type) { case *rpc.StartEgressRequest_RoomComposite: - accept = available >= m.cpuCostConfig.RoomCompositeCpuCost + required = m.cpuCostConfig.RoomCompositeCpuCost case *rpc.StartEgressRequest_Web: - accept = available >= m.cpuCostConfig.WebCpuCost + required = m.cpuCostConfig.WebCpuCost case *rpc.StartEgressRequest_Participant: - accept = available >= m.cpuCostConfig.ParticipantCpuCost + required = m.cpuCostConfig.ParticipantCpuCost case *rpc.StartEgressRequest_TrackComposite: - accept = available >= m.cpuCostConfig.TrackCompositeCpuCost + required = m.cpuCostConfig.TrackCompositeCpuCost case *rpc.StartEgressRequest_Track: - accept = available >= m.cpuCostConfig.TrackCpuCost + required = m.cpuCostConfig.TrackCpuCost } + accept = available >= required + + logger.Debugw("cpu check", + "available", available, + "required", required, + "activeRequests", m.requests, + "canAccept", accept, + ) return accept }