Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't register failed renewal alert if the host ran out of funds #1173

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion autopilot/contractor/contractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
rhpv2 "go.sia.tech/core/rhp/v2"
rhpv3 "go.sia.tech/core/rhp/v3"
"go.sia.tech/core/types"
cwallet "go.sia.tech/coreutils/wallet"
"go.sia.tech/renterd/alerts"
"go.sia.tech/renterd/api"
"go.sia.tech/renterd/internal/utils"
Expand Down Expand Up @@ -984,7 +985,16 @@ func (c *Contractor) runContractRenewals(ctx *mCtx, w Worker, toRenew []contract
contract := toRenew[i].contract.ContractMetadata
renewed, proceed, err := c.renewContract(ctx, w, toRenew[i], budget)
if err != nil {
c.alerter.RegisterAlert(ctx, newContractRenewalFailedAlert(contract, !proceed, err))
// don't register an alert for hosts that are out of funds since the
// user can't do anything about it
if !(worker.IsErrHost(err) && utils.IsErr(err, cwallet.ErrNotEnoughFunds)) {
c.alerter.RegisterAlert(ctx, newContractRenewalFailedAlert(contract, !proceed, err))
}
c.logger.With(zap.Error(err)).
With("fcid", toRenew[i].contract.ID).
With("hostKey", toRenew[i].contract.HostKey).
With("proceed", proceed).
Errorw("failed to renew contract")
if toRenew[i].usable {
toKeep = append(toKeep, toRenew[i].contract.ContractMetadata)
}
Expand Down
Loading