Remove symlink
This commit is contained in:
parent
f2f3e9de88
commit
a5ef2de3e4
@ -42,15 +42,15 @@ class Context implements EventEmitterInterface
|
|||||||
$this->eventLoop->run();
|
$this->eventLoop->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit(callable $task, ...$args): void
|
public function submit(callable $job, ...$args): void
|
||||||
{
|
{
|
||||||
$this->eventLoop->futureTick(function () use ($task, $args) {
|
$this->eventLoop->futureTick(function () use ($job, $args) {
|
||||||
if ($this->concurrency->isReachedBy(count($this->workers))) {
|
if ($this->concurrency->isReachedBy(count($this->workers))) {
|
||||||
$this->emit('congestion');
|
$this->emit('congestion');
|
||||||
$this->workers->awaitCongestionRelief();
|
$this->workers->awaitCongestionRelief();
|
||||||
$this->emit('congestion_relieved');
|
$this->emit('congestion_relieved');
|
||||||
}
|
}
|
||||||
$this->workers->createWorkerFor($task, $args);
|
$this->workers->createWorkerFor($job, $args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ class Workers implements Countable, EventEmitterInterface
|
|||||||
return count($this->workers);
|
return count($this->workers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createWorkerFor(callable $task, array $args = []): void
|
public function createWorkerFor(callable $job, array $args = []): void
|
||||||
{
|
{
|
||||||
$pid = $this->forkWorker($task, $args);
|
$pid = $this->forkWorker($job, $args);
|
||||||
$this->workers[$pid] = $pid;
|
$this->workers[$pid] = $pid;
|
||||||
$this->emit('worker_started', [$pid]);
|
$this->emit('worker_started', [$pid]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user