Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaking result cache metadata #588

Merged
merged 15 commits into from
May 1, 2018
Merged

Leaking result cache metadata #588

merged 15 commits into from
May 1, 2018

Conversation

pmelab
Copy link
Contributor

@pmelab pmelab commented Apr 29, 2018

No description provided.

return $callback($value, $args, $context, $info);
});
$renderContext = new RenderContext();
$result = $callback($value, $args, $context, $info);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving that outside of the render context kinda defeats the whole point, no?

Copy link
Contributor Author

@pmelab pmelab Apr 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result is either a callable or a generator. And the generator is evaluated further down in iterator_to_array. Thats what I discovered when writing the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So thats what has to be wrapped in the render context.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, let's move the line with new RenderContext() down there too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with that 😃

@codecov
Copy link

codecov bot commented Apr 29, 2018

Codecov Report

Merging #588 into 8.x-3.x will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           8.x-3.x     #588      +/-   ##
===========================================
+ Coverage     80.4%   80.44%   +0.03%     
===========================================
  Files          185      185              
  Lines         2848     2853       +5     
===========================================
+ Hits          2290     2295       +5     
  Misses         558      558
Impacted Files Coverage Δ
src/Plugin/GraphQL/Fields/FieldPluginBase.php 97.53% <100%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 38597d6...d5ed2a3. Read the comment docs.

@fubhy
Copy link
Contributor

fubhy commented Apr 29, 2018

@pmelab I updated the PR. I think we need to wrap the whole thing.

protected function resolveDeferred(callable $callback, $value, array $args, ResolveContext $context, ResolveInfo $info) {
$renderContext = new RenderContext();
return $this->getRenderer()->executeInRenderContext($renderContext, function () use ($value, $args, $context, $info) {
$result = $callback($value, $args, $context, $info);
Copy link
Contributor

@awm086 awm086 Apr 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add $callback and $renderContext to the use statement.


return $this->unwrapResult($result, $info);
return $this->unwrapResult($result, $info);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build fails for syntax error ... I think you're missing ); here.

@fubhy
Copy link
Contributor

fubhy commented Apr 29, 2018

I shouldn't try and edit this on my windows dual boot from the github text editor :D

@pmelab pmelab merged commit a77d377 into 8.x-3.x May 1, 2018
@fubhy fubhy deleted the test-leaking-cache-metadata branch May 25, 2018 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants