1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-26 20:34:40 +01:00

Pool::get() → Pool::getWorker()

Also renamed Worker\get() to Worker\pool()->getWorker().
This commit is contained in:
Aaron Piotrowski 2018-10-25 09:54:40 -05:00
parent 9098d26b56
commit 1c1d22b7f6
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
4 changed files with 7 additions and 7 deletions

View File

@ -205,7 +205,7 @@ final class DefaultPool implements Pool
/**
* {@inheritdoc}
*/
public function get(): Worker
public function getWorker(): Worker
{
return new Internal\PooledWorker($this->pull(), $this->push);
}

View File

@ -18,7 +18,7 @@ interface Pool extends Worker
*
* @throws \Amp\Parallel\Context\StatusError If the queue is not running.
*/
public function get(): Worker;
public function getWorker(): Worker;
/**
* Gets the number of workers currently running in the pool.

View File

@ -47,13 +47,13 @@ function enqueue(Task $task): Promise
*
* @return \Amp\Parallel\Worker\Worker
*/
function get(): Worker
function worker(): Worker
{
return pool()->get();
return pool()->getWorker();
}
/**
* Creates a worker using the global worker factory. The worker is automatically started.
* Creates a worker using the global worker factory.
*
* @return \Amp\Parallel\Worker\Worker
*/

View File

@ -71,7 +71,7 @@ abstract class AbstractPoolTest extends TestCase
yield $pool->shutdown();
$pool->get();
$pool->getWorker();
});
}
@ -134,7 +134,7 @@ abstract class AbstractPoolTest extends TestCase
Loop::run(function () {
$pool = $this->createPool();
$worker = $pool->get();
$worker = $pool->getWorker();
$this->assertInstanceOf(Worker::class, $worker);
$this->assertTrue($worker->isRunning());