Skip to content

Commit

Permalink
Use IORuntime.global rather than runtime based on context of scalatest
Browse files Browse the repository at this point in the history
  • Loading branch information
custommonkey committed Sep 23, 2022
1 parent ccfbb2d commit 29f898c
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ import org.scalatest.AsyncTestSuite
import org.scalatest.enablers.Retrying
import org.scalatest.time.Span

import scala.concurrent.ExecutionContext.global

trait AsyncIOSpec extends AssertingSyntax with EffectTestSupport with RuntimePlatform { asyncTestSuite: AsyncTestSuite =>

implicit lazy val ioRuntime: IORuntime = createIORuntime(global)
implicit lazy val ioRuntime: IORuntime = IORuntime.global

implicit def ioRetrying[T]: Retrying[IO[T]] = new Retrying[IO[T]] {
override def retry(timeout: Span, interval: Span, pos: Position)(fun: => IO[T]): IO[T] =
IO.fromFuture(
IO(Retrying.retryingNatureOfFutureT[T](global).retry(timeout, interval, pos)(fun.unsafeToFuture())),
IO(Retrying.retryingNatureOfFutureT[T](IORuntime.global.compute).retry(timeout, interval, pos)(fun.unsafeToFuture())),
)
}
}

0 comments on commit 29f898c

Please sign in to comment.