mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 15:14:38 +00:00
Do not continue if semaphore can't be acquired (#49)
This commit is contained in:
parent
30034f5d28
commit
c742f6a816
1 changed files with 4 additions and 1 deletions
|
@ -293,7 +293,10 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk) err
|
|||
errs := []error{}
|
||||
var errsMut sync.Mutex
|
||||
for i, repoURL := range s.repos {
|
||||
s.jobSem.Acquire(ctx, 1)
|
||||
if err := s.jobSem.Acquire(ctx, 1); err != nil {
|
||||
log.WithError(err).Debug("could not acquire semaphore")
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
go func(ctx context.Context, repoURL string, i int) {
|
||||
defer s.jobSem.Release(1)
|
||||
|
|
Loading…
Reference in a new issue