Skip to content

Commit

Permalink
fix: suspicious data race on go test ./... -race
Browse files Browse the repository at this point in the history
in `TestQuickResultsShouldArriveFirst`
d-led committed Sep 19, 2024
1 parent ef959aa commit 67dd2cc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions infrastructure/url_checker.go
Original file line number Diff line number Diff line change
@@ -377,6 +377,7 @@ type URLCheckerPluginTrace struct {
// CheckURL checks a single URL
func (c *URLCheckerClient) CheckURL(ctx context.Context, url string) *URLCheckResult {
var lastRes *URLCheckResult = nil
var result URLCheckResult
var checkerTrace []URLCheckerPluginTrace
start := time.Now()
errorMessage := ""
@@ -407,12 +408,14 @@ func (c *URLCheckerClient) CheckURL(ctx context.Context, url string) *URLCheckRe
}

if lastRes != nil {
lastRes.CheckerTrace = checkerTrace
result = *lastRes
result.CheckerTrace = checkerTrace
elapsed := time.Since(start)
lastRes.ElapsedMs = int64(elapsed / time.Millisecond)
result.ElapsedMs = int64(elapsed / time.Millisecond)
return &result
}

return lastRes
return nil
}

func normalizeAddressOf(input string) string {

0 comments on commit 67dd2cc

Please sign in to comment.