Make crl-updater deadline setting clearer (#8027)

Rather than using context.WithTimeout to magically convert a timeout to
a deadline for us, compute the deadline ourselves and then set it
directly on the context.
This commit is contained in:
Aaron Gable 2025-02-28 17:24:37 -06:00 committed by GitHub
parent f6702fffe8
commit 10d9ef9af7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -138,9 +138,9 @@ func NewUpdater(
// updateShardWithRetry calls updateShard repeatedly (with exponential backoff
// between attempts) until it succeeds or the max number of attempts is reached.
func (cu *crlUpdater) updateShardWithRetry(ctx context.Context, atTime time.Time, issuerNameID issuance.NameID, shardIdx int, chunks []chunk) error {
ctx, cancel := context.WithTimeout(ctx, cu.updateTimeout)
deadline := cu.clk.Now().Add(cu.updateTimeout)
ctx, cancel := context.WithDeadline(ctx, deadline)
defer cancel()
deadline, _ := ctx.Deadline()
if chunks == nil {
// Compute the shard map and relevant chunk boundaries, if not supplied.