Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not share err variable between worker goroutines #267

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/dnsbench/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ func (b *Benchmark) Run(ctx context.Context) ([]*ResultStats, error) {
st := newResultStats(b)
stats[w] = st

var err error
wg.Add(1)
go func(workerID uint32, st *ResultStats) {
defer func() {
Expand Down Expand Up @@ -400,7 +399,6 @@ func (b *Benchmark) Run(ctx context.Context) ([]*ResultStats, error) {
return
}
}
var resp *dns.Msg

req := dns.Msg{}
req.RecursionDesired = b.Recurse
Expand Down Expand Up @@ -433,7 +431,7 @@ func (b *Benchmark) Run(ctx context.Context) ([]*ResultStats, error) {
start := time.Now()

reqTimeoutCtx, cancel := context.WithTimeout(ctx, b.RequestTimeout)
resp, err = query(reqTimeoutCtx, b.Server, &req)
resp, err := query(reqTimeoutCtx, b.Server, &req)
cancel()
dur := time.Since(start)
if b.RequestLogEnabled {
Expand Down
Loading