Skip to content

Conversation

@bbakerman
Copy link
Member

No description provided.

@dfa1
Copy link
Contributor

dfa1 commented Jun 1, 2023

@bbakerman what about using a single .handle?

        return fetchedValue
                .handle((result, exception) -> {
                    fetchCtx.onCompleted(result, exception);
                    if (exception != null) {
                        result = handleFetchingException(executionContext, dataFetchingEnvironment.get(), exception);
                    }
                    return unboxPossibleDataFetcherResult(executionContext, parameters, result);
                });

@bbakerman
Copy link
Member Author

What about using a single .handle?
Ahh I tried it - it wont work

The error handler returns CF<U> while .handle() needs to a <U> so we need to compose afterwards - I dont think there is any saving to be made here

protected <T> CompletableFuture<T> handleFetchingException(ExecutionContext executionContext,
DataFetchingEnvironment environment,
Throwable e) {
protected <T> CompletableFuture<T> handleFetchingException(
Copy link
Member Author

Choose a reason for hiding this comment

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

never used

*
* @throws java.lang.ClassCastException if it's not an Iterable
*/
protected Iterable<Object> toIterable(Object result) {
Copy link
Member Author

Choose a reason for hiding this comment

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

never used

@bbakerman bbakerman added the breaking change requires a new major version to be relased label Jun 2, 2023
@bbakerman bbakerman added this to the 2023 July milestone Jun 2, 2023
*
* @throws java.lang.ClassCastException if it's not an Iterable
*/
protected Iterable<Object> toIterable(Object result) {
Copy link
Member Author

Choose a reason for hiding this comment

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

technically a breaking change BUT a low risk one

@bbakerman bbakerman added the performance work that is primarily targeted as performance improvements label Jun 2, 2023
@bbakerman bbakerman added this pull request to the merge queue Jun 7, 2023
Merged via the queue into master with commit d4f1756 Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change requires a new major version to be relased performance work that is primarily targeted as performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants