Skip to content

Commit 2e4dc96

Browse files
committed
fix: prevent timer leaks in DNS verification retry logic
1 parent d8dba84 commit 2e4dc96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/verification/dns.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,13 @@ func performDNSVerificationWithRetries(
179179
attempt, config.MaxRetries, domain, retryDelay)
180180

181181
// Wait before retry with context cancellation support
182+
timer := time.NewTimer(retryDelay)
182183
select {
183-
case <-time.After(retryDelay):
184+
case <-timer.C:
185+
// Timer fired normally, continue with retry
184186
case <-ctx.Done():
187+
// Context cancelled, stop timer to prevent leak
188+
timer.Stop()
185189
return nil, &DNSVerificationError{
186190
Domain: domain,
187191
Token: expectedToken,

0 commit comments

Comments
 (0)