mirror of
https://github.com/amphp/parallel.git
synced 2025-02-20 04:44:36 +01:00
Faster freeing of task memory
This commit is contained in:
parent
aaee76e3da
commit
0e71b18197
@ -37,11 +37,7 @@ class TaskRunner {
|
||||
$job = yield $this->channel->receive();
|
||||
|
||||
while ($job instanceof Internal\Job) {
|
||||
$task = $job->getTask();
|
||||
|
||||
$result = call([$task, 'run'], $this->environment);
|
||||
|
||||
$result->onResolve(function ($exception, $value) use ($job) {
|
||||
call([$job->getTask(), 'run'], $this->environment)->onResolve(function ($exception, $value) use ($job) {
|
||||
if ($exception) {
|
||||
$result = new Internal\TaskFailure($job->getId(), $exception);
|
||||
} else {
|
||||
@ -51,6 +47,8 @@ class TaskRunner {
|
||||
$this->channel->send($result);
|
||||
});
|
||||
|
||||
unset($job); // Free memory from last job.
|
||||
|
||||
$job = yield $this->channel->receive();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user