Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cancel source task directly after timeout #462
This is contrary to the documentation and the intended behaviour.
@@ Coverage Diff @@ ## master #462 +/- ## ========================================== + Coverage 88.85% 89.18% +0.32% ========================================== Files 351 351 Lines 9567 9525 -42 Branches 1254 1269 +15 ========================================== - Hits 8501 8495 -6 + Misses 1066 1030 -36
With the current implementation:
The result will be that the backup task will get canceled and the calculation continues with the result of the source task while the whole computation took 3 seconds which is longer as the specified timeout.
With my code change the source task would race against an already completed task (unit) which gets delayed by the specified timeout (don't know if delayedresult would be more performand).
So if the timeout is reached without the source task completing in time, it will get canceled before the backup task is even started. It also doesn't matter anymore how long the execution of the backup task takes.