cats-effect-cps icon indicating copy to clipboard operation
cats-effect-cps copied to clipboard

make resulting effect cancellable again

Open cornerman opened this issue 1 year ago • 2 comments

Currently, any effect created by the async macro is not cancelable. This PR fixes that.

Probably a regression after the semantics of async_/async changed in regards to cancellability.

I have also fixed the test for "be cancellable" - which was not asserting correctly.

cornerman avatar Jan 18 '24 18:01 cornerman

Somehow the "be cancellable" test is now flaky - I could make it pass reliably with this change: https://github.com/typelevel/cats-effect-cps/pull/192/commits/99e8dbf1171dd97b31bd0abc4809d61ab5bacfe4.

But this looks suspicious to me, maybe there is something else going on?

cornerman avatar Jan 18 '24 20:01 cornerman

I have added a potential fix, which makes the test pass without the above mentioned workaround. See: https://github.com/typelevel/cats-effect-cps/pull/192/commits/c4e98a8940581e87fc647401fcd029a386449896

There, I have introduced a stopSignal to cancel tasks running in the dispatcher, when the actual effect is cancelled. Please let me know, if this makes sense or whether there is a better fix. From what I can see, it does solve the issue at hand.

cornerman avatar Jan 18 '24 22:01 cornerman