Skip to content

Commit

Permalink
Do not continue if semaphore can't be acquired (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-rich authored and dustin-decker committed Mar 4, 2022
1 parent 30034f5 commit c742f6a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/sources/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c742f6a

Please sign in to comment.