Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cancellation hook from Future.finally
To make Future.finally more reliable as a tool which guarantees execution of the cleanup handler, it would run and cancel the handler when it would itself be cancelled. However, this behaviour is subject to some issues: - The cleanup handler would run when a Future prior to the finally-call got cancelled, leading to attempts to dispose yet-to-be-acquired resources. - The cleanup handler would be immediately cancelled, which meant that unless it was prepared for ignoring the cancellation signal, cleanup wouldn't even happen. This commit fixes both of those issues by removing this behaviour altogether. Finally then becomes a function to use solely for cases where something should happen as a side-effect under rejection and under resolution of a Future, as its documentation already states.
- Loading branch information