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:
parent
9098d26b56
commit
1c1d22b7f6
@ -205,7 +205,7 @@ final class DefaultPool implements Pool
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function get(): Worker
|
public function getWorker(): Worker
|
||||||
{
|
{
|
||||||
return new Internal\PooledWorker($this->pull(), $this->push);
|
return new Internal\PooledWorker($this->pull(), $this->push);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ interface Pool extends Worker
|
|||||||
*
|
*
|
||||||
* @throws \Amp\Parallel\Context\StatusError If the queue is not running.
|
* @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.
|
* Gets the number of workers currently running in the pool.
|
||||||
|
@ -47,13 +47,13 @@ function enqueue(Task $task): Promise
|
|||||||
*
|
*
|
||||||
* @return \Amp\Parallel\Worker\Worker
|
* @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
|
* @return \Amp\Parallel\Worker\Worker
|
||||||
*/
|
*/
|
||||||
|
@ -71,7 +71,7 @@ abstract class AbstractPoolTest extends TestCase
|
|||||||
|
|
||||||
yield $pool->shutdown();
|
yield $pool->shutdown();
|
||||||
|
|
||||||
$pool->get();
|
$pool->getWorker();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ abstract class AbstractPoolTest extends TestCase
|
|||||||
Loop::run(function () {
|
Loop::run(function () {
|
||||||
$pool = $this->createPool();
|
$pool = $this->createPool();
|
||||||
|
|
||||||
$worker = $pool->get();
|
$worker = $pool->getWorker();
|
||||||
$this->assertInstanceOf(Worker::class, $worker);
|
$this->assertInstanceOf(Worker::class, $worker);
|
||||||
|
|
||||||
$this->assertTrue($worker->isRunning());
|
$this->assertTrue($worker->isRunning());
|
||||||
|
Loading…
Reference in New Issue
Block a user