diff --git a/internal/api/acme/validators.go b/internal/api/acme/validators.go index 76fbbae..286a1e2 100644 --- a/internal/api/acme/validators.go +++ b/internal/api/acme/validators.go @@ -191,8 +191,9 @@ func (p *Pool) Drain(ctx context.Context) error { } } -// Snapshot returns the current per-type in-flight + peak counts. Used -// by chaos tests to verify the configured weights were never exceeded. +// PoolSnapshot is the per-type in-flight + peak observation set used by +// chaos / concurrency tests to verify the configured weights were never +// exceeded. type PoolSnapshot struct { HTTP01InFlight int64 HTTP01Peak int64 @@ -202,6 +203,7 @@ type PoolSnapshot struct { TLSALPN01Peak int64 } +// Snapshot returns the current per-type in-flight + peak counts. func (p *Pool) Snapshot() PoolSnapshot { return PoolSnapshot{ HTTP01InFlight: p.http01InFlight.Load(), diff --git a/internal/service/acme.go b/internal/service/acme.go index 326667c..6062c84 100644 --- a/internal/service/acme.go +++ b/internal/service/acme.go @@ -1235,10 +1235,11 @@ func (s *ACMEService) RespondToChallenge( } // Submit to the pool. The onComplete callback persists the final - // challenge status + cascades the parent authz status. We use a - // fresh background context here so the callback's WithinTx isn't - // canceled when the originating HTTP request returns. - bgctx := context.Background() + // challenge status + cascades the parent authz status. We detach + // from the request context via context.WithoutCancel so the + // callback's WithinTx survives the HTTP handler returning, while + // preserving inherited values (logger, trace IDs, audit actor). + bgctx := context.WithoutCancel(ctx) chSnapshot := *ch authzSnapshot := *authz identifier := authz.Identifier.Value