This commit is contained in:
ponzischeme89
2026-08-16 12:13:51 +12:00
parent bd3732fba5
commit b9374baaf1
47 changed files with 2793 additions and 364 deletions
+19
View File
@@ -136,6 +136,25 @@ func (q *Queue) Len() int {
return len(q.items)
}
// SetLimit applies an operator change immediately. The strongest candidates survive a
// reduction, using the same ordering as Claim, so changing the setting cannot reshuffle
// the meaning of priority.
func (q *Queue) SetLimit(limit int) {
if limit <= 0 {
return
}
q.mu.Lock()
defer q.mu.Unlock()
q.limit = limit
for len(q.items) > q.limit {
weakestID, _ := q.weakestLocked()
if weakestID == "" {
break
}
delete(q.items, weakestID)
}
}
// Snapshot is the queue in worker order, for the log line and the admin console.
func (q *Queue) Snapshot() []Candidate {
q.mu.Lock()