1
0
Fork 0

Fix a couple async bugs

pull/8952/head
Jordi Boggiano 2020-06-05 09:39:11 +02:00
parent 3af617efe8
commit b1e15c7725
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 3 additions and 3 deletions

View File

@ -187,12 +187,12 @@ class ProcessExecutor
$self->markJobDone(); $self->markJobDone();
return $job['process']; return $job['process'];
}, function () use (&$job, $self) { }, function ($e) use (&$job, $self) {
$job['status'] = ProcessExecutor::STATUS_FAILED; $job['status'] = ProcessExecutor::STATUS_FAILED;
$self->markJobDone(); $self->markJobDone();
return \React\Promise\reject($job['process']); throw $e;
}); });
$this->jobs[$job['id']] =& $job; $this->jobs[$job['id']] =& $job;
@ -272,7 +272,7 @@ class ProcessExecutor
public function hasActiveJob($index = null) public function hasActiveJob($index = null)
{ {
// tick // tick
foreach ($this->jobs as &$job) { foreach ($this->jobs as $job) {
if ($job['status'] === self::STATUS_STARTED) { if ($job['status'] === self::STATUS_STARTED) {
if (!$job['process']->isRunning()) { if (!$job['process']->isRunning()) {
call_user_func($job['resolve'], $job['process']); call_user_func($job['resolve'], $job['process']);