Partial Errors caching #2608
mostafa-rz
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
I see your point. Very roughly, I could see something the implementation looking something like this: $errorsListener = $this->errorPool->listen();
$resolved = $resolver($root, $args, $context, $resolveInfo);
$storeInCache = $maxAge
? static fn ($result): bool => $cache->put($cacheKey, ['data' => $result, 'errors' => $errorsListener->errors()], Carbon::now()->addSeconds($maxAge))
: static fn ($result): bool => $cache->forever($cacheKey, ['data' => $result, 'errors' => $errorsListener->errors()]);
Resolved::handle($resolved, $storeInCache); Would you be willing to implement this? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I use
ErrorPool
in my resolver and add the cache directive to the field, it works as expected by the first request. I will get the result + error. For the second request, the result is loaded from the cache, therefore the error is not shown anymore in the final result.I think the result should not be cached when an error exists, or at least it should be optional in the lighthouse config to respect the
ErroPool
.Beta Was this translation helpful? Give feedback.
All reactions