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

Fix twifkak@ last comments from #349. #369

Merged
merged 1 commit into from
Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions packager/certcache/certcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const ocspCheckInterval = 1 * time.Hour
const certCheckInterval = 24 * time.Hour

// Max number of OCSP request tries.
// This will timeout after 2^10 minutes or ~16 hours.
// This will timeout after 1 + 2 + 4 + 8 + 10 * 6 = 75 minutes.
const maxOCSPTries = 10

// Recommended renewal duration for certs. This is duration before next cert expiry.
Expand Down Expand Up @@ -108,7 +108,7 @@ type CertCache struct {
// Callers can use the uninitialized CertCache for testing certificates (without doing OCSP or
// cert refreshes).
//
// TODO(banaag): per greigable@ comments:
// TODO(banaag): per gregable@ comments:
// The long argument list makes the callsites tricky to read and easy to get wrong, especially if several of the arguments have the same type.
//
// An alternative pattern would be to create an IsInitialized() bool or similarly named function that verifies all of the required fields have
Expand Down Expand Up @@ -358,13 +358,6 @@ func (this *CertCache) readOCSPHelper(numTries int, exhaustedRetries bool) ([]by
}

// Returns the OCSP response and expiry, refreshing if necessary.
// TODO(banaag): Per twifkak's suggestion, consider:
// It may also be interesting to try to separate the retry logic from the fetch logic. One approach comes to mind:
//
// retryWithBackoff(func() {
// ocsp, err := ...
// return true if successful
// }, initialWaitTime, maxTries)
func (this *CertCache) readOCSP(allowRetries bool) ([]byte, time.Time, error) {
var ocspUpdateAfter time.Time
var err error
Expand Down