-
-
Notifications
You must be signed in to change notification settings - Fork 10
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 "count" from the Queue interface #13
Comments
... why? |
There are several reasons that come to mind:
Do you use |
Yes - scaling workers. If the queue size > (current workers * 10) = scale up |
Will the option 2) work for you? Roughly speaking, to scale workers all you need to know is the queue size, so // WorkerManager
public function maybeScale(\Countable $pool)
{
$count = count($pool);
if ($count > $numberOfWorkers * 10) {
// create more workers
} else if ($count < $numberOfWorkers) {
// destroy workers
}
} And your workers will process the // Worker
public function process(Queue $queue)
{
$item = $queue->pop();
// process the item
} |
Yes that would work. :-) |
Options:
Remove
count()
method from queuesLeave
count()
and addCountable
interface:count()
into separate interface:The text was updated successfully, but these errors were encountered: