Skip to content

Commit

Permalink
autopilot: don't consider hosts bad when we have a contract with them…
Browse files Browse the repository at this point in the history
… and 'scanned=false'
  • Loading branch information
ChrisSchinnerl committed Nov 6, 2024
1 parent 1b506ab commit a84a0c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion autopilot/contractor/contractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,14 @@ func performContractChecks(ctx *mCtx, alerter alerts.Alerter, bus Bus, w Worker,
continue
}

// NOTE: if we have a contract with a host that is not scanned, we either
// added the host and contract manually or reset the host scans. In that case,
// we ignore the fact that the host is not scanned for now to avoid churn.
if check.Usability.NotCompletingScan {
check.Usability.NotCompletingScan = false
check.Usability.Offline = false
}

// check usability
if !check.Usability.IsUsable() {
reasons := strings.Join(check.Usability.UnusableReasons(), ",")
Expand Down Expand Up @@ -1099,7 +1107,7 @@ func performContractFormations(ctx *mCtx, bus Bus, w Worker, cr contractReviser,
allHosts, err := bus.SearchHosts(ctx, api.SearchHostOptions{
Limit: -1,
FilterMode: api.HostFilterModeAllowed,
UsabilityMode: api.UsabilityFilterModeAll,
UsabilityMode: api.UsabilityFilterModeUsable,
})
if err != nil {
return nil, fmt.Errorf("failed to fetch usable hosts: %w", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
UPDATE hosts SET settings = '{}', price_table = '{}', last_scan = 0, last_scan_success = 0, second_to_last_scan_success = 0 WHERE 1=1;
UPDATE hosts SET settings = '{}', price_table = '{}', last_scan = 0, last_scan_success = 0, second_to_last_scan_success = 0, scanned = 0 WHERE 1=1;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
UPDATE hosts SET settings = '{}', price_table = '{}', last_scan = 0, last_scan_success = 0, second_to_last_scan_success = 0 WHERE 1=1;
UPDATE hosts SET settings = '{}', price_table = '{}', last_scan = 0, last_scan_success = 0, second_to_last_scan_success = 0, scanned = 0 WHERE 1=1;

0 comments on commit a84a0c1

Please sign in to comment.