Skip to content

Commit

Permalink
Move count increment outside of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Jan 9, 2019
1 parent 1a5af92 commit d6e14d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions processor/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ func walkDirectoryParallel(root string, output chan *FileJob) {
go func(toWalk string) {
filejobs := walkDirectory(toWalk, PathBlacklist, extensionLookup)
for i := 0; i < len(filejobs); i++ {
mutex.Lock()
totalCount += len(filejobs)
mutex.Unlock()

LoadLanguageFeature(filejobs[i].Language)
output <- &filejobs[i]
}

mutex.Lock()
totalCount += len(filejobs)
mutex.Unlock()

// Turn GC back to what it was before if we have parsed enough files
if !resetGc && totalCount >= GcFileCount {
debug.SetGCPercent(gcPercent)
Expand Down

0 comments on commit d6e14d7

Please sign in to comment.