Skip to content

Commit

Permalink
Merge pull request #268 from onflow/rbtz/limitGoRoutines
Browse files Browse the repository at this point in the history
Limit number of goroutines in FastCommit()
  • Loading branch information
fxamacker authored Jun 3, 2022
2 parents 525fbc2 + f439666 commit 9de15f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ func (s *PersistentSlabStorage) FastCommit(numWorkers int) error {
return nil
}

// limit the number of workers to the number of keys
if numWorkers > len(keysWithOwners) {
numWorkers = len(keysWithOwners)
}

// construct job queue
jobs := make(chan StorageID, len(keysWithOwners))
for _, id := range keysWithOwners {
Expand Down

0 comments on commit 9de15f4

Please sign in to comment.