Avoid performing duplicate tasks when they are rebased #2690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
Previously when a task was rebased, it was only added to the pending tasks list once the task it was being rebased onto completed. If duplicate tasks were requested before the dependent task completed, they would all be scheduled to execute after it. This resulted in duplicate work being performed and a
NullPointerException
when later tasks completed and found the result future had already been removed.Now the result future is added to pending tasks immediately regardless of whether the task is rebased or immediately added to the queue. Duplicates then simply return the existing pending result and are not executed themselves.
Fixed Issue(s)
fixes #2685
fixes #2686
Documentation
documentation
label to this PR if updates are required.