Commit
Most of the complexity in AbstractWorker was to support out-of-order task execution.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,11 +61,11 @@ public function __construct(int $maxSize = self::DEFAULT_MAX_SIZE, WorkerFactory | |
$this->idleWorkers = new \SplQueue; | ||
$this->busyQueue = new \SplQueue; | ||
|
||
$workers = &$this->workers; | ||
$idleWorkers = &$this->idleWorkers; | ||
$busyQueue = &$this->busyQueue; | ||
$workers = $this->workers; | ||
$idleWorkers = $this->idleWorkers; | ||
$busyQueue = $this->busyQueue; | ||
|
||
$this->push = static function (Worker $worker) use (&$workers, &$idleWorkers, &$busyQueue) { | ||
$this->push = static function (Worker $worker) use ($workers, $idleWorkers, $busyQueue) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
trowski
Author
Member
|
||
\assert($workers->contains($worker), "The provided worker was not part of this queue"); | ||
|
||
if (($workers[$worker] -= 1) === 0) { | ||
|
6 comments
on commit 77e5583
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.
I guess this is not backwards compatible, as technically this code supported concurrent tasks?
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.
TaskRunner
didn't execute tasks concurrently, so it doesn't matter as the tasks were always run one at a time, in order.
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.
Yes, but the Worker API could be used on its own, no? Why is it not in an internal namespace?
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.
TaskRunner
is not in an internal namespace in case someone wanted to roll there own context for a worker. To depend on the tasks running concurrently someone would have had to then use internal classes (Job
in particular`), so I do not believe this is a BC break.
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.
Then let's release it.
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.
As soon as the tests on Travis work.
Why did you remove the references here?