mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Use GQLPromise::then() in all() to match SyncPromiseAdapter
Call through GQLPromise::then() instead of directly on adopted promise. This matches how SyncPromiseAdapter handles promise chaining. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
ca30269486
commit
5138ebec7b
@@ -95,21 +95,15 @@ class Swoole extends Adapter
|
||||
foreach ($promisesOrValues as $index => $promiseOrValue) {
|
||||
if ($promiseOrValue instanceof GQLPromise) {
|
||||
$result[$index] = null;
|
||||
/** @var SwoolePromise $adopted */
|
||||
$adopted = $promiseOrValue->adoptedPromise;
|
||||
$adopted->then(
|
||||
static function ($value) use (&$result, $index, &$count, $checkComplete) {
|
||||
// Use GQLPromise::then() which goes through adapter->then()
|
||||
// This matches SyncPromiseAdapter's behavior
|
||||
$promiseOrValue->then(
|
||||
static function ($value) use (&$result, $index, &$count, $checkComplete): void {
|
||||
$result[$index] = $value;
|
||||
++$count;
|
||||
$checkComplete();
|
||||
return $value;
|
||||
},
|
||||
static function ($error) use (&$rejected, $combinedPromise) {
|
||||
if (!$rejected) {
|
||||
$rejected = true;
|
||||
$combinedPromise->reject($error);
|
||||
}
|
||||
}
|
||||
[$combinedPromise, 'reject']
|
||||
);
|
||||
} else {
|
||||
$result[$index] = $promiseOrValue;
|
||||
|
||||
Reference in New Issue
Block a user