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

Remove mutex from ReusableGoroutinesPool #610

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

colega
Copy link
Contributor

@colega colega commented Oct 14, 2024

What this PR does:

I find it unsettling that we need to acquire a mutex (a concurrency primitive) to send data to a channel (another concurrency primitive).

I think this achieves the same effect (we can stop the worker goroutines in a safe way) without having to mix them and leaving the main code path clear (just try to send a job, or run a new goroutine).

Which issue(s) this PR fixes:

This is a follow up on #607

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

I find it unsettling that we need to acquire a mutex (a concurrency
primitive) to send data to a channel (another concurrency primitive).

I think this achieves the same effect (we can stop the worker
goroutines in a safe way) without having to mix them and leaving the
main code path clear (just try to send a job, or run a new goroutine).

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@colega colega merged commit d3f80b0 into main Oct 14, 2024
5 checks passed
@colega colega deleted the remove-mutex-from-reusable-goroutines-pool branch October 14, 2024 09:20
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