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

(BIDS-2469) Handle sql.ErrNoRows for missed attestations #2541

Merged
merged 3 commits into from
Sep 12, 2023

Conversation

D13ce
Copy link
Contributor

@D13ce D13ce commented Sep 8, 2023

This PR handles young validators that have no entry in the stats table properly on the validator page.
Problems where introduced here: 68902dc

It also fixes concurrency issues with the err variable.

return fmt.Errorf("error retrieving validator attestationStats: %w", err)
err := db.ReaderDb.Get(&attestationStats, "SELECT missed_attestations_total AS missed_attestations FROM validator_stats WHERE validatorindex = $1 AND day = $2", index, lastStatsDay)
if err == sql.ErrNoRows {
logger.Warningf("no entry in validator_stats for validator index %v while lastStatsDay = %v", index, lastStatsDay)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning was requested by @recy21 .

Copy link
Collaborator

@Eisei24 Eisei24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

handlers/validator.go Outdated Show resolved Hide resolved
@D13ce D13ce merged commit ab3844a into master Sep 12, 2023
3 checks passed
@D13ce D13ce deleted the BIDS-2469/FixValidatorPageForYoungValidators branch September 12, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants