Skip to content

Commit 80b36bf

Browse files
aphansal123Copilot
andauthored
User time.NewTimer and explicitly stop
Co-authored-by: Copilot <[email protected]>
1 parent f2e1fde commit 80b36bf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/verification/dns_mock.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func (m *MockDNSResolver) LookupTXT(ctx context.Context, name string) ([]string,
3131
// Simulate delay if configured
3232
if m.Delay > 0 {
3333
select {
34-
case <-time.After(m.Delay):
34+
timer := time.NewTimer(m.Delay)
35+
defer timer.Stop()
36+
select {
37+
case <-timer.C:
3538
case <-ctx.Done():
3639
return nil, ctx.Err()
3740
}

0 commit comments

Comments
 (0)