Display Num Pruned Items in Slasher Only When Actually Prunes (#9989)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan 2021-12-07 09:38:19 -05:00 committed by GitHub
parent 2bcda2e021
commit 1eff00fb33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,10 +216,14 @@ func (s *Service) pruneSlasherDataWithinSlidingWindow(ctx context.Context, curre
if err != nil { if err != nil {
return errors.Wrap(err, "Could not prune proposals") return errors.Wrap(err, "Could not prune proposals")
} }
log.WithFields(logrus.Fields{ fields := logrus.Fields{}
"prunedAttestationRecords": numPrunedAtts, if numPrunedAtts > 0 {
"prunedProposalRecords": numPrunedProposals, fields["numPrunedAtts"] = numPrunedAtts
"elapsed": time.Since(start), }
}).Info("Successfully ran slasher data pruning") if numPrunedProposals > 0 {
fields["numPrunedProposals"] = numPrunedProposals
}
fields["elapsed"] = time.Since(start)
log.WithFields(fields).Info("Done pruning old attestations and proposals for slasher")
return nil return nil
} }