Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upper limit on file parsing goroutines #74

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

Kbhat1
Copy link
Contributor

@Kbhat1 Kbhat1 commented Sep 16, 2024

Describe your changes and provide context

  • Adds upper limit on number of goroutines spun up to read kv files

Testing performed to validate your change

  • Verifying on node

Comment on lines +238 to +252
go func() {
defer wg.Done()

kvEntries, err := ReadKVEntriesFromFile(filepath.Join(id, selectedFile))
if err != nil {
panic(err)
for selectedFile := range filesChan {
kvEntries, err := ReadKVEntriesFromFile(filepath.Join(inputDir, selectedFile))
if err != nil {
panic(err)
}

// Safely append the kvEntries to allKVs
mu.Lock()
allKVs = append(allKVs, kvEntries...)
fmt.Printf("Done processing file %+v\n", filepath.Join(inputDir, selectedFile))
mu.Unlock()
}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
@Kbhat1 Kbhat1 merged commit b04b4ba into main Sep 17, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants