Skip to content

refactor(goroutine): improve concurrency safety and testing #122

New issue

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

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

Already on GitHub? # to your account

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 <appleboy.tw@gmail.com>
@appleboy appleboy merged commit 043417e into master Feb 18, 2024
@appleboy appleboy deleted the testing branch February 18, 2024 03:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant