Skip to content

Commit

Permalink
Reset finalizers to avoid leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou committed Jul 10, 2024
1 parent d4af6b6 commit 06539bc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ private[query] object QueryScope {
def closeAndExitWith[E, A](exit: Exit[E, A])(implicit trace: Trace): IO[E, A] = {
val finalizers = ref.get
if (finalizers.isEmpty) exit
else ZIO.foreachDiscard(finalizers)(_(exit)) *> exit
else {
ref.set(Nil)
ZIO.foreachDiscard(finalizers)(_(exit)) *> exit
}
}
}
}

0 comments on commit 06539bc

Please sign in to comment.