Skip to content

Commit

Permalink
fix max concurrent web check
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 committed Nov 19, 2024
1 parent 6cd90ce commit fdb81f1
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions pkg/stats/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,31 +164,39 @@ func (m *Monitor) canAcceptRequestLocked(req *rpc.StartEgressRequest) ([]interfa
}

required := req.EstimatedCpu
if required == 0 {
switch r := req.Request.(type) {
case *rpc.StartEgressRequest_RoomComposite:
if m.webRequests.Load() >= m.cpuCostConfig.MaxConcurrentWeb {
return fields, false
}
switch r := req.Request.(type) {
case *rpc.StartEgressRequest_RoomComposite:
if m.webRequests.Load() >= m.cpuCostConfig.MaxConcurrentWeb {
return fields, false
}
if required == 0 {
if r.RoomComposite.AudioOnly {
required = m.cpuCostConfig.AudioRoomCompositeCpuCost
} else {
required = m.cpuCostConfig.RoomCompositeCpuCost
}
case *rpc.StartEgressRequest_Web:
if m.webRequests.Load() >= m.cpuCostConfig.MaxConcurrentWeb {
return fields, false
}
}
case *rpc.StartEgressRequest_Web:
if m.webRequests.Load() >= m.cpuCostConfig.MaxConcurrentWeb {
return fields, false
}
if required == 0 {
if r.Web.AudioOnly {
required = m.cpuCostConfig.AudioWebCpuCost
} else {
required = m.cpuCostConfig.WebCpuCost
}
case *rpc.StartEgressRequest_Participant:
}
case *rpc.StartEgressRequest_Participant:
if required == 0 {
required = m.cpuCostConfig.ParticipantCpuCost
case *rpc.StartEgressRequest_TrackComposite:
}
case *rpc.StartEgressRequest_TrackComposite:
if required == 0 {
required = m.cpuCostConfig.TrackCompositeCpuCost
case *rpc.StartEgressRequest_Track:
}
case *rpc.StartEgressRequest_Track:
if required == 0 {
required = m.cpuCostConfig.TrackCpuCost
}
}
Expand Down

0 comments on commit fdb81f1

Please sign in to comment.