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

`Dispatcher` that backpressures on completion (not cancellation)

Open armanbilge opened this issue 4 years ago • 1 comments
trafficstars

Spinning out of https://github.com/typelevel/cats-effect/issues/2519#issuecomment-963620976, which will be closed shortly.

Idk if it's possible/makes sense, but an alternative API where closing backpressures until completion (rather than cancellation) could be interesting? It could reject new submissions, but wait until old ones are all done.

Not sure if this applicable to Supervisor itself.

armanbilge avatar Nov 13 '21 11:11 armanbilge

One possible flaw with this idea is that if you start a never-completing fiber (e.g. a server) with dispatcher and don't have any way to cancel it, then unless your dispatcher cancels it on close are you are stuck :)

armanbilge avatar Dec 05 '21 20:12 armanbilge

This is actually done in 3.4.0

djspiewak avatar Oct 29 '22 19:10 djspiewak