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(goroutine): improve concurrency safety and testing #122

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

appleboy
Copy link
Member

  • Enable race condition detection in Go tests by adding -race flag
  • Refactor Queue to use a local variable for workerCount with proper locking
  • Refactor Ring to use a local variable for count with proper locking and defer unlocking
  • Replace direct access to busyWorkers metric with BusyWorkers() method in tests

- Enable race condition detection in Go tests by adding `-race` flag
- Refactor `Queue` to use a local variable for `workerCount` with proper locking
- Refactor `Ring` to use a local variable for `count` with proper locking and defer unlocking
- Replace direct access to `busyWorkers` metric with `BusyWorkers()` method in tests

Signed-off-by: Bo-Yi Wu <[email protected]>
@appleboy appleboy merged commit 043417e into master Feb 18, 2024
13 checks passed
@appleboy appleboy deleted the testing branch February 18, 2024 03:06
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.

1 participant