Skip to content

Commit 6766161

Browse files
committed
fix: data race on worker
1 parent 7df52f5 commit 6766161

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

worker/worker.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (w *Worker) processInfinity(ctx context.Context) {
6262
return
6363
}
6464

65-
parallel := parallel.NewParallel(ctx, w.parallelism)
65+
parallel := parallel.NewParallel(ctx, atomic.LoadInt32(&w.parallelism))
6666
defer parallel.Close()
6767
w.mu.Lock()
6868
w.parallel = parallel
@@ -90,7 +90,7 @@ func (w *Worker) processLimited(ctx context.Context, limit int) {
9090
return
9191
}
9292

93-
parallel := parallel.NewParallel(ctx, w.parallelism)
93+
parallel := parallel.NewParallel(ctx, atomic.LoadInt32(&w.parallelism))
9494
defer parallel.Close()
9595
w.mu.Lock()
9696
w.parallel = parallel

0 commit comments

Comments
 (0)