(agentID uuid.UUID)
| 445 | } |
| 446 | |
| 447 | func (m *MultiAgentController) acquireTicket(agentID uuid.UUID) (release func()) { |
| 448 | id := uuid.New() |
| 449 | m.mu.Lock() |
| 450 | defer m.mu.Unlock() |
| 451 | m.tickets[agentID][id] = struct{}{} |
| 452 | |
| 453 | return func() { |
| 454 | m.mu.Lock() |
| 455 | defer m.mu.Unlock() |
| 456 | delete(m.tickets[agentID], id) |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | func (m *MultiAgentController) expireOldAgents(ctx context.Context) { |
| 461 | defer close(m.expireOldAgentsDone) |