-
Notifications
You must be signed in to change notification settings - Fork 114
Add worker_pool:dispatch_sync
function
#368
Conversation
Make use of the new dispatch_sync function in rabbitmq/rabbitmq-common#368 to block only when all workers are busy
dispatch_sync sits inbetween the behavior of submit and submit_async, blocking the caller until a worker begins the task, as opposed to not blocking at all, or blocking util the task has finished. This is useful when you want to throttle submissions to the pool from a single process, such that all workers are busy, but there exists no backlog of work for the pool.
a9e6849
to
150f8b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a worker pool suite in the server repo. These tests should be moved there or that suite should be moved to this repo but we should not keep both.
I'll move that suite here, since I think next to it's implementation is a more obvious location (I looked for the suite before creating this one, but didn't find it). |
according to Michael's suggestion
to consolidate worker pool tests in a single location
The new tests depend on |
Thanks @michaelklishin |
@michaelklishin I need the |
Make use of the new dispatch_sync function in rabbitmq/rabbitmq-common#368 to block only when all workers are busy (cherry picked from commit 01270fd)
Backported to 3.8.x as part of #387. |
dispatch_sync
sits in between the behavior ofsubmit
andsubmit_async
, blocking the caller until a worker begins the task (submit
blocks until the task is scheduled and complete, whilesubmit_async
does not block at all).This is useful when you want to throttle submissions to the pool from a single process, such that all workers are busy, but there exists no backlog of work for the pool.