(ctx context.Context)
| 458 | } |
| 459 | |
| 460 | func (m *MultiAgentController) expireOldAgents(ctx context.Context) { |
| 461 | defer close(m.expireOldAgentsDone) |
| 462 | defer m.logger.Debug(context.Background(), "stopped expiring old agents") |
| 463 | const ( |
| 464 | tick = 5 * time.Minute |
| 465 | cutoff = 30 * time.Minute |
| 466 | ) |
| 467 | |
| 468 | ticker := time.NewTicker(tick) |
| 469 | defer ticker.Stop() |
| 470 | |
| 471 | for { |
| 472 | select { |
| 473 | case <-ctx.Done(): |
| 474 | return |
| 475 | case <-ticker.C: |
| 476 | } |
| 477 | |
| 478 | m.doExpireOldAgents(ctx, cutoff) |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | func (m *MultiAgentController) doExpireOldAgents(ctx context.Context, cutoff time.Duration) { |
| 483 | // TODO: add some attrs to this. |
no test coverage detected