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

Cancel long poll if a Future returned from getResultAsync is not referenced anymore by the user code #1212

Open
Spikhalskiy opened this issue May 13, 2022 · 0 comments
Labels
enhancement User experience

Comments

@Spikhalskiy
Copy link
Contributor

Is your feature request related to a problem? Please describe.

If we hit WorkflowStub#getResultAsync and after that, we either don't wait on the result at all or wait for a bit and discard after, the long poll continues to run.
This creates a need for an unpleasant, unconventional WorkflowStub#getResultAsync(resultType, timeout).
Why do users need to pass a timeout to getResultAsync if they pass it into Future.get(timeout).
Most users just use WorkflowStub#getResultAsync(resultType) not understanding that they create a leak if the workflows don't finish fast.

Describe the solution you'd like
Instead of that, Temporal Java SDK code should maintain a weak or phantom reference on the CompletableFuture that we return to the users and cancel the background long poll when it's discarded by the user code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement User experience
Projects
None yet
Development

No branches or pull requests

1 participant