Skip to content

Commit

Permalink
autopilog: fix race
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Mar 14, 2024
1 parent b9ae383 commit 9618fbf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions autopilot/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ func (s *scanner) tryPerformHostScan(ctx context.Context, w scanWorker, force bo
s.logger.Infof("%s started", scanType)

s.wg.Add(1)
s.ap.wg.Add(1)
go func(st string) {
defer s.wg.Done()
defer s.ap.wg.Done()

for resp := range s.launchScanWorkers(ctx, w, s.launchHostScans()) {
if s.isInterrupted() || s.ap.isStopped() {
Expand Down Expand Up @@ -250,10 +252,7 @@ func (s *scanner) tryUpdateTimeout() {

func (s *scanner) launchHostScans() chan scanReq {
reqChan := make(chan scanReq, s.scanBatchSize)

s.ap.wg.Add(1)
go func() {
defer s.ap.wg.Done()
defer close(reqChan)

var offset int
Expand Down

0 comments on commit 9618fbf

Please sign in to comment.