Commit 81a9a28
committed
withAsyncTaskCleanupHandler calls its cleanup handler twice if body throws
If the body closure given to withAsyncTaskCleanupHandler throws, its cleanup handler is called twice: once in the catch block where body is called, and then again in the task group task once the Task.sleep throws due to cancellation, which swallows the error and then continues to call the handler as well. That results in the teardown sequence being invoked twice, as well as the teardown sequence being invoked for non-error cases.
This patch ensures the cleanup handler is invoked in failure cases only, and only once.
Closes #801 parent ca05b23 commit 81a9a28
1 file changed
+28
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
| 755 | + | |
755 | 756 | | |
756 | 757 | | |
757 | 758 | | |
758 | 759 | | |
759 | 760 | | |
| 761 | + | |
760 | 762 | | |
761 | 763 | | |
762 | 764 | | |
| |||
767 | 769 | | |
768 | 770 | | |
769 | 771 | | |
770 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
771 | 796 | | |
772 | 797 | | |
773 | 798 | | |
774 | 799 | | |
775 | | - | |
| 800 | + | |
776 | 801 | | |
777 | 802 | | |
778 | | - | |
| 803 | + | |
779 | 804 | | |
780 | 805 | | |
781 | 806 | | |
| |||
0 commit comments