add server agent load threshold config (#3520)
* remove agent worker load threshold * cleanup
This commit is contained in:
@@ -17,7 +17,6 @@ package service
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"slices"
|
"slices"
|
||||||
@@ -43,8 +42,6 @@ import (
|
|||||||
"github.com/livekit/psrpc"
|
"github.com/livekit/psrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
const agentWorkerLoadTarget = 0.65
|
|
||||||
|
|
||||||
type AgentSocketUpgrader struct {
|
type AgentSocketUpgrader struct {
|
||||||
websocket.Upgrader
|
websocket.Upgrader
|
||||||
}
|
}
|
||||||
@@ -260,8 +257,6 @@ func (h *AgentHandler) registerWorker(w *agent.Worker) {
|
|||||||
typeTopic = h.participantTopic
|
typeTopic = h.participantTopic
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(">>> register worker", typeTopic)
|
|
||||||
|
|
||||||
err := h.agentServer.RegisterJobRequestTopic(nameTopic, typeTopic)
|
err := h.agentServer.RegisterJobRequestTopic(nameTopic, typeTopic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.mu.Unlock()
|
h.mu.Unlock()
|
||||||
@@ -431,7 +426,7 @@ func (h *AgentHandler) JobRequestAffinity(ctx context.Context, job *livekit.Job)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if w.Status() == livekit.WorkerStatus_WS_AVAILABLE {
|
if w.Status() == livekit.WorkerStatus_WS_AVAILABLE {
|
||||||
affinity += max(0, agentWorkerLoadTarget-w.Load())
|
affinity += max(0, 1-w.Load())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user