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 {
return errors.Wrap(err, "Could not prune proposals")
}
log.WithFields(logrus.Fields{
"prunedAttestationRecords": numPrunedAtts,
"prunedProposalRecords": numPrunedProposals,
"elapsed": time.Since(start),
}).Info("Successfully ran slasher data pruning")
fields := logrus.Fields{}
if numPrunedAtts > 0 {
fields["numPrunedAtts"] = numPrunedAtts
}
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
}