typelevel / typelevel/cats-effect
better handling of callbacks that might throw in `CallbackStack`
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 576
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
Capturing @durban's question here: https://github.com/typelevel/cats-effect/pull/3973#issuecomment-1913140555
And also @armanbilge: https://github.com/typelevel/cats-effect/pull/3943#discussion_r1451633273
I think we're all agreed that the remaining callbacks shouldn't just be abandoned, and when talking it through with Arman he had a proposed refactor:
if CallbackStack encounters a throwing callback, it can install the current/next node as the head in the finally and then let the throw continue
this leaves it up to the caller to decide what they want to do
if they're cool with the exception and want to invoke the rest of the callbacks, they can just call apply again
if they want to tear down, maybe we can bring back clear for this
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked pull request comment and discussion, then locate CallbackStack in the cats-effect runtime. Trace how a throwing callback currently affects the remaining callbacks and compare that behavior with the proposed refactor. Done means the remaining callbacks are preserved and callers can decide whether to continue or tear down.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100