Skip to content

Commit

Permalink
Merge pull request #418 from permutive-engineering/async-leak
Browse files Browse the repository at this point in the history
Fix potential async leak
  • Loading branch information
TimWSpence authored Nov 10, 2022
2 parents 502de2f + c828c65 commit 0b25e9c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import com.google.common.util.concurrent.MoreExecutors

private[internal] object FutureInterop {
def fFromFuture[F[_]: Async, A](future: F[ApiFuture[A]]): F[A] =
future.flatMap { futA =>
Async[F]
.async[A] { cb =>
Async[F]
.async[A] { cb =>
future.flatMap { futA =>
Sync[F].delay {
val futureApi = futA
addCallback(futureApi)(cb)
Expand All @@ -47,7 +47,7 @@ private[internal] object FutureInterop {
)
}
}
}
}

@inline
private def addCallback[A](futA: ApiFuture[A])(cb: Either[Throwable, A] => Unit): Unit =
Expand Down

0 comments on commit 0b25e9c

Please sign in to comment.