fix: 从后端恢复 Runner claim
test / python (pull_request) Successful in 9s
test / shell (pull_request) Successful in 15s
test / go (pull_request) Successful in 2m18s

This commit is contained in:
2026-09-21 06:18:23 +00:00
parent 6bb654a4b7
commit 5e94182308
8 changed files with 151 additions and 0 deletions
+18
View File
@@ -90,3 +90,21 @@ func (r *Registry) Remove(assignmentID string) {
defer r.mu.Unlock()
delete(r.claims, assignmentID)
}
// RecoverClaimed restores authorization for an executor that already claimed
// its task before the controller restarted.
func (r *Registry) RecoverClaimed(assignment taskassignment.Assignment) error {
ready, err := r.Offer(assignment)
if err != nil {
return err
}
r.mu.Lock()
entry := r.claims[assignment.ID]
if !entry.claimed {
entry.claimed = true
close(entry.ready)
}
r.mu.Unlock()
<-ready
return nil
}