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

Refactor batcher and fix race condition #47

Merged
merged 2 commits into from Feb 19, 2024
Merged

Refactor batcher and fix race condition #47

merged 2 commits into from Feb 19, 2024

Conversation

eapache
Copy link
Owner

@eapache eapache commented Feb 19, 2024

Fixes #46

- Run CI tests with race detection enabled so CI will catch issues like this in the future
- Replace done channel with a WaitGroup to fix a race condition and to
  properly wait for *all* active batches during shutdown
- Use time.AfterFunc() instead of manually spawning a goroutine and
  calling sleep()
- Improve a few method names and doc comments
- move some logic from batch() to submitWork() so it's always obvious
  what is or isn't guarded by the lock

- Replace done channel with a WaitGroup to fix a race condition and to
  properly wait for *all* active batches during shutdown
- Use time.AfterFunc() instead of manually spawning a goroutine and
  calling sleep()
- Improve a few method names and doc comments
- move some logic from batch() to submitWork() so it's always obvious
  what is or isn't guarded by the lock
@eapache eapache merged commit 1d46cb6 into main Feb 19, 2024
4 checks passed
@eapache eapache deleted the fix-batcher-race branch February 19, 2024 15:56
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.

race condition error on batcher
1 participant