lower job load

This commit is contained in:
Paul Wells
2024-09-18 01:28:02 -07:00
parent d09a338609
commit eed840b535
2 changed files with 6 additions and 4 deletions
+4 -1
View File
@@ -106,7 +106,10 @@ func TestAgentLoadBalancing(t *testing.T) {
agents := make([]*testutils.AgentWorker, totalWorkers)
for i := 0; i < totalWorkers; i++ {
agents[i] = server.SimulateAgentWorker(testutils.WithLabel(fmt.Sprintf("agent-%d", i)))
agents[i] = server.SimulateAgentWorker(
testutils.WithLabel(fmt.Sprintf("agent-%d", i)),
testutils.WithJobLoad(testutils.NewStableJobLoad(0.01)),
)
agents[i].Register("test", livekit.JobType_JT_ROOM)
}
+2 -3
View File
@@ -21,6 +21,7 @@ import (
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/utils/must"
"github.com/livekit/protocol/utils/options"
"github.com/livekit/psrpc"
)
@@ -103,9 +104,7 @@ func (h *TestServer) SimulateAgentWorker(opts ...SimulatedWorkerOption) *AgentWo
HandleAvailability: func(r AgentJobRequest) { r.Accept() },
HandleAssignment: func(j *livekit.Job) JobLoad { return nil },
}
for _, opt := range opts {
opt(o)
}
options.Apply(o, opts)
w := &AgentWorker{
workerMessages: make(chan *livekit.WorkerMessage, 1),