Apollo Java: how do i wait for a response using Rx3Apollo #5777
-
My code for now is this: public Result<Status, T> execute() {
AtomicReference<Result<Status, T>> result = new AtomicReference<>(Result.result(Status.FAILED, null));
Rx3Apollo.from(getGraphQLCall())
.filter(response -> !response.hasErrors())
.map(Response::getData)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.computation())
.blockingSubscribe(successfulResponse -> result.set(Result.result(Status.SUCCESS, successfulResponse)), error -> {
if (error instanceof ApolloNetworkException networkException)
result.set(Result.result(Status.NO_NETWORK.setThrowable(networkException), null));
result.set(Result.result(Status.FAILED.setThrowable(error), null));
});
return result.get();
} This works fine but when this is finished the client does not exit. I looked at the threads and it shows that this call is still running. How do i fix this? |
Beta Was this translation helpful? Give feedback.
Answered by
martinbonnin
Oct 6, 2021
Replies: 1 comment 3 replies
-
Hi 👋 ! Looks like this is an apollo-android issue? I'll move this discussion to an issue there. First time I try this in production 😅 . Finger crossed it'll land in the correct repo with all the comments :) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
JustRed23
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi 👋 ! Looks like this is an apollo-android issue? I'll move this discussion to an issue there. First time I try this in production 😅 . Finger crossed it'll land in the correct repo with all the comments :)