Skip to content

Commit

Permalink
Merge pull request #4168 from durban/if_registerCallback
Browse files Browse the repository at this point in the history
Only remove error callback if we've added it
  • Loading branch information
durban authored Nov 16, 2024
2 parents 3891409 + 98abb46 commit dd1c0f5
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions core/shared/src/main/scala/cats/effect/IO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1009,21 +1009,16 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {

val fiber = new IOFiber[A](
Map.empty,
oc =>
{ oc =>
if (registerCallback) {
runtime.fiberErrorCbs.remove(failure)
}
oc.fold(
{
runtime.fiberErrorCbs.remove(failure)
canceled
},
{ t =>
runtime.fiberErrorCbs.remove(failure)
failure(t)
},
{ ioa =>
runtime.fiberErrorCbs.remove(failure)
success(ioa.asInstanceOf[IO.Pure[A]].value)
}
),
canceled,
failure,
{ ioa => success(ioa.asInstanceOf[IO.Pure[A]].value) }
)
},
this,
runtime.compute,
runtime
Expand Down

0 comments on commit dd1c0f5

Please sign in to comment.