Fix setting nested promise

This commit is contained in:
Jake Barnby 2022-04-08 00:23:45 +12:00
parent 10449822ce
commit 75fec18356
No known key found for this signature in database
GPG key ID: A4674EBC0E404657

View file

@ -181,8 +181,10 @@ class SwoolePromise
private function setResult(mixed $value): void
{
if (!$value instanceof SwoolePromise) {
throw new \RuntimeException('Supported only Appwrite\GraphQL\SwoolePromise instance');
$this->result = $value;
return;
}
$resolved = false;
$callable = function ($value) use (&$resolved) {
$this->setResult($value);
@ -193,8 +195,6 @@ class SwoolePromise
while (!$resolved) {
usleep(25000);
}
$this->result = $value;
}
/**