You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issues using TypeResolver, BatchedExecutionStrategy and CompletableFuture together #672
It seems that if you're using the BatchedExecutionStrategy and a DataFetcher that provides an interface type returns a CompletableFuture, the CompletableFuture rather than the raw value is passed to the TypeResolver for the interface.
I have had a look at this more and its tricky one to fix (easily) because of the internal structure of the BatchExecutionStrategy
the root cause is that the BacthedES expects the return value to always be a Iterable but what we need up is producing a Iterable that is a list with a CF inside it
We wrap that list in a CF in the code but its a CF pointing to a List.
These objects get passed into as handled as actual objects and not CFS
handleResult ...
List<Object> values = result;
List<FetchedValue> retVal = new ArrayList<>();
for (int i = 0; i < parentResults.size(); i++) {
Object value = unboxPossibleOptional(values.get(i));
retVal.add(new FetchedValue(parentResults.get(i), value));
}
return retVal;
eg the object placed into FetchedValue is in fact treated as completed - when in fact it is not completed yet.
Later those fetched results are sent to handlePrimitive and so on a they get treated as coerced objects etc...
I think the FetchedValue idea needs to be come a FetchedValue of CF promises and not objects
I have confirmed this is fixed for me on master. It would be really great to get this into a 4.1.x or a 4.2 release along with the introspection fixes. Thanks!
Activity
vincentDAO commentedon Sep 1, 2017
I also got same issue when using BatchedExecutionStrategy and DataFetcher<CompletableFuture<?>> together.
bbakerman commentedon Sep 6, 2017
I have had a look at this more and its tricky one to fix (easily) because of the internal structure of the BatchExecutionStrategy
the root cause is that the BacthedES expects the return value to always be a Iterable but what we need up is producing a Iterable that is a list with a CF inside it
We wrap that list in a CF in the code but its a CF pointing to a List.
These objects get passed into as handled as actual objects and not CFS
handleResult ...
eg the object placed into FetchedValue is in fact treated as completed - when in fact it is not completed yet.
Later those fetched results are sent to handlePrimitive and so on a they get treated as coerced objects etc...
I think the FetchedValue idea needs to be come a FetchedValue of CF promises and not objects
bbakerman commentedon Sep 6, 2017
also the mutation of the parent structure makes this super tough
This is pushing state up into the parent which also assumes the value is resolved. Hmmmm
bbakerman commentedon Sep 6, 2017
I take it back its easy to fix. As I described the problem it told me the answer
List<CF> needs to become CF<List
And CF.allOf() allows this
arlampin commentedon Sep 6, 2017
@bbakerman there's already an open PR that fixes this
drewolson commentedon Sep 7, 2017
I have confirmed this is fixed for me on master. It would be really great to get this into a
4.1.xor a4.2release along with the introspection fixes. Thanks!andimarek commentedon Sep 7, 2017
yes, we will do
4.2.drewolson commentedon Sep 7, 2017
Great, thanks!
vincentDAO commentedon Sep 8, 2017
Great! We're waiting to upgrade our app to 4.2.