refactor(scheduler): remove dead code

Remove three unused methods/parameter identified by static analysis:
- canRequeue(): never integrated into scheduling flow
- runMetricsClient clientID param: accepted but never used
- getUsageLocked(): callers inline the logic

Fixes IDE warnings about unused code per AGENTS.md cleanup discipline.
This commit is contained in:
Jeremie Fraeys 2026-03-04 13:35:18 -05:00
parent 7cd86fb88a
commit 08ab628546
No known key found for this signature in database
2 changed files with 2 additions and 37 deletions

View file

@ -270,7 +270,7 @@ func (h *SchedulerHub) HandleConnection(w http.ResponseWriter, r *http.Request)
// Check if this is a metrics client (special token prefix)
if strings.HasPrefix(clientID, "metrics-") {
go h.runMetricsClient(clientID, conn)
go h.runMetricsClient(conn)
return
}
@ -447,30 +447,6 @@ func (h *SchedulerHub) canAdmit(candidate *Task, worker *WorkerConn) bool {
return worker.capabilities.GPUCount >= candidate.Spec.GPUCount
}
// canRequeue checks if a task can be re-queued based on wall-clock elapsed time.
// Returns false if the task has exceeded its MaxRuntime budget.
func (h *SchedulerHub) canRequeue(task *Task) bool {
if task.FirstAssignedAt.IsZero() {
return true // Never assigned, can always re-queue
}
elapsed := time.Since(task.FirstAssignedAt)
maxRuntime := task.MaxRuntime
if maxRuntime == 0 {
maxRuntime = 24 * time.Hour // Default 24h
}
if elapsed > maxRuntime {
// Task exceeded wall-clock budget - fail it
slog.Info("task exceeded max runtime, failing",
"task_id", task.ID,
"elapsed", elapsed,
"max_runtime", maxRuntime)
return false
}
return true
}
func (h *SchedulerHub) assignTask(task *Task, wc *WorkerConn) Message {
// Remove from queue first (prevent double-assignment)
h.batchQueue.Remove(task.ID)
@ -880,7 +856,7 @@ func (h *SchedulerHub) sendPrewarmHint(task *Task) {
}
// runMetricsClient handles metrics clients over WSS
func (h *SchedulerHub) runMetricsClient(clientID string, conn *websocket.Conn) {
func (h *SchedulerHub) runMetricsClient(conn *websocket.Conn) {
defer conn.Close()
for {

View file

@ -274,14 +274,3 @@ func (m *PluginQuotaManager) getUserLimit(userID string) UserLimit {
MaxServices: m.config.PerUserServices,
}
}
// getUsageLocked returns the current usage for a user-plugin combination.
// Must be called with read lock held.
func (m *PluginQuotaManager) getUsageLocked(userID, pluginName string) PluginUsage {
if userPlugins, ok := m.usage[userID]; ok {
if usage, ok := userPlugins[pluginName]; ok {
return usage
}
}
return PluginUsage{}
}