rocsp-tool: don't log every 10th insert (#6017)

Logging every 10 is quite noisy; instead adopt the same strategy we use
for errors, and log all of them at first, fading out to fewer of them as
we get to bigger numbers.
This commit is contained in:
Jacob Hoffman-Andrews 2022-03-25 11:43:26 -07:00 committed by GitHub
parent 7c22b99d63
commit 6271a88ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -114,7 +114,11 @@ func (cl *client) loadFromDB(ctx context.Context, speed ProcessingSpeed, startFr
successCount++
}
if (successCount+errorCount)%10 == 0 {
total := successCount + errorCount
if total < 10 ||
(total < 1000 && rand.Intn(1000) < 100) ||
(total < 100000 && rand.Intn(1000) < 10) ||
(rand.Intn(1000) < 1) {
cl.logger.Infof("stored %d responses, %d errors", successCount, errorCount)
}
}