fix(scanner): spawn interval scans in a goroutine
this way, if the average scan takes longer than the tick interval, the ticker will be unblocked and scans won't stack on top of each other related #63
This commit is contained in:
@@ -271,9 +271,11 @@ func (s *Server) StartScanTicker(dur time.Duration) (FuncExecute, FuncInterrupt)
|
||||
case <-done:
|
||||
return nil
|
||||
case <-ticker.C:
|
||||
if err := s.scanner.Start(scanner.ScanOptions{}); err != nil {
|
||||
log.Printf("error scanning: %v", err)
|
||||
}
|
||||
go func() {
|
||||
if err := s.scanner.Start(scanner.ScanOptions{}); err != nil {
|
||||
log.Printf("error scanning: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user