Skip to content

Commit

Permalink
(NOBIDS) Improve query by using field missed_attestations_total (inst…
Browse files Browse the repository at this point in the history
…ead of SUM)
  • Loading branch information
recy21 committed Sep 4, 2023
1 parent fd56e35 commit 68902dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handlers/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,9 @@ func Validator(w http.ResponseWriter, r *http.Request) {
MissedAttestations uint64 `db:"missed_attestations"`
}{}
if lastStatsDay > 0 {
err = db.ReaderDb.Get(&attestationStats, "select coalesce(sum(missed_attestations), 0) as missed_attestations from validator_stats where validatorindex = $1", index)
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 != nil {
return fmt.Errorf("error retrieving validator attestationStats: %v", err)
return fmt.Errorf("error retrieving validator attestationStats: %w", err)
}
}

Expand Down

0 comments on commit 68902dc

Please sign in to comment.