Skip to content

Commit

Permalink
autopilot: try fix TestHostPruning NDF
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Mar 12, 2024
1 parent 0a1f609 commit 6e0a5c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions autopilot/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,18 @@ func (ap *Autopilot) Run() error {
ap.workers.withWorker(func(w Worker) {
defer ap.logger.Info("autopilot iteration ended")

// log worker id chosen for this maintenance iteration.
workerID, err := w.ID(ap.shutdownCtx)
if err != nil {
ap.logger.Warn("failed to reach worker, err: %v", err)
} else {
ap.logger.Infof("using worker %s for iteration", workerID)
}

// initiate a host scan - no need to be synced or configured for scanning
ap.s.tryUpdateTimeout()
ap.s.tryPerformHostScan(ap.shutdownCtx, w, forceScan)

// reset forceScan
forceScan = false
forceScan = false // reset forceScan

// block until consensus is synced
if synced, blocked, interrupted := ap.blockUntilSynced(ap.ticker.C); !synced {
Expand All @@ -270,14 +276,6 @@ func (ap *Autopilot) Run() error {
return
}

// Log worker id chosen for this maintenance iteration.
workerID, err := w.ID(ap.shutdownCtx)
if err != nil {
ap.logger.Errorf("aborting maintenance, failed to fetch worker id, err: %v", err)
return
}
ap.logger.Infof("using worker %s for iteration", workerID)

// update the loop state
//
// NOTE: it is important this is the first action we perform in this
Expand Down
2 changes: 1 addition & 1 deletion autopilot/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (m *migrator) performMigrations(p *workerPool) {
// fetch worker id once
id, err := w.ID(ctx)
if err != nil {
m.logger.Errorf("failed to fetch worker id: %v", err)
m.logger.Errorf("failed to reach worker, err: %v", err)
return
}

Expand Down

0 comments on commit 6e0a5c1

Please sign in to comment.