Cats-effect: Auto-cancellation of flatMap chains docs are outdated

Created on 20 May 2019  路  4Comments  路  Source: typelevel/cats-effect

According to the documentation, flatMap chains are not cancellable. The comment of cancelBoundary also hints at this. However, the implementation seems to auto-cancel, see here and here. Is the documentation/comment outdated, or am I misunderstanding the implementation?

docs

Most helpful comment

The docs are outdated :)

All 4 comments

The docs are outdated :)

Ok, thanks. Does that mean that cancelBoundary is a no-op now? (Or does it make an async boundary?)

cancelBoundary has not changed, it introduces what we call a lightweight async boundary, i.e. it does not submit to a thread pool, but only to a trampoline. Given that it's still an Async node, it can be canceled (this is all independent of the cancelable flatMap thing)

I think we fixed the docs (the link in OP directs to the version https://github.com/typelevel/cats-effect/blame/eed64fa38d03dadba3c8cb55f18c82e9e98828b6/site/src/main/tut/datatypes/io.md#L368) - they now say

We should also note that flatMap chains are only cancelable only if the chain happens after an asynchronous boundary. After an asynchronous boundary, cancellation checks are performed on every N flatMap. The value of N is hardcoded to 512.

Fixed in https://github.com/typelevel/cats-effect/pull/730

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RaasAhsan picture RaasAhsan  路  4Comments

Avasil picture Avasil  路  3Comments

kubukoz picture kubukoz  路  7Comments

ronanM picture ronanM  路  5Comments

jchapuis picture jchapuis  路  6Comments