Skip to content

Commit 4f59bb5

Browse files
LennardWesterveldfubhy
authored andcommitted
Improve performance for cached responses. (#714)
1 parent 33a905a commit 4f59bb5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/GraphQL/Execution/QueryProcessor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ protected function executeOperation(PromiseAdapter $adapter, ServerConfig $confi
197197
throw new RequestError('GET requests are only supported for query operations.');
198198
}
199199

200-
// If one of the validation rules found any problems, do not resolve the
201-
// query and bail out early instead.
202-
if ($errors = $this->validateOperation($config, $params, $document)) {
203-
return $adapter->createFulfilled(new QueryResult(NULL, $errors));
204-
}
205-
206200
// Only queries can be cached (mutations and subscriptions can't).
207201
if ($type === 'query') {
208202
return $this->executeCacheableOperation($adapter, $config, $params, $document);
@@ -283,6 +277,12 @@ protected function executeUncachableOperation(PromiseAdapter $adapter, ServerCon
283277
* @return \GraphQL\Executor\Promise\Promise
284278
*/
285279
protected function doExecuteOperation(PromiseAdapter $adapter, ServerConfig $config, OperationParams $params, DocumentNode $document) {
280+
// If one of the validation rules found any problems, do not resolve the
281+
// query and bail out early instead.
282+
if ($errors = $this->validateOperation($config, $params, $document)) {
283+
return $adapter->createFulfilled(new QueryResult(NULL, $errors));
284+
}
285+
286286
$operation = $params->operation;
287287
$variables = $params->variables;
288288
$context = $this->resolveContextValue($config, $params, $document, $operation);

0 commit comments

Comments
 (0)