-
Notifications
You must be signed in to change notification settings - Fork 11
Deferred resolving doesn't seem to work #336
Comments
Related to #320 |
@Jalle19 I took a look at this and you're right. The issue is that the promise is resolved immediately. I need to do some research. It might be that we need to introduce our own Deferred concept, like they have done in Webonyx implementation. I don't like the idea, but if it that's what it takes then we'll do that. |
Any news on this? |
@crisu83 do you have time to look into this? |
or @hungneox |
Confirm this issue. |
Guys, this issue is critical for production use. Do you have any suggestions? If you do not have time, tell me which way to dig? |
This is literally the only reason I haven't swapped to this over my Youshido Fork. |
Is there any thought to use https://github.com/overblog/dataloader-php |
I'm trying to adapt this library for my reactphp-project. I was able to perform a deferred request using lordthorzonus/php-dataloader. But for this I had to change the graphql-php code to support async calls. Because the existing executor have a race condition problem if ($data instanceof PromiseInterface) {
$data->then(function ($resolvedData) use (&$data) {
$data = $resolvedData;
});
}
<...>
return new ExecutionResult($data, $context->getErrors()); In this section of the code, the class Execution implements ExecutionInterface, PromisedExecutionInterface
{
<...>
public function promiseExecute(
Schema $schema,
DocumentNode $documentNode,
$rootValue = null,
$contextValue = null,
array $variableValues = [],
?string $operationName = null,
?callable $fieldResolver = null,
?ErrorHandlerInterface $errorHandler = null
): PromiseInterface {
<...>
if ($data instanceof PromiseInterface) {
return $data->then(function ($resolvedData) use ($context) {
return new ExecutionResult($resolvedData, $context->getErrors());
});
}
<...>
return resolve(new ExecutionResult($data, $context->getErrors()));
}
<...>
} I can provide PR, but I need help with tests. |
@acelot PRs are more than welcome, I'll help you out with the tests! |
@acelot is this issue resolved? |
Yes, completely. |
There's something wrong with it. In the test we end up calling
loadBuffered()
twice, which shouldn't happen. There's also both$directorIds
and$authors
, which seems wrong. Gotta look this through carefully.The text was updated successfully, but these errors were encountered: