All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ing.baker.runtime.defaultinteractions.TimerInteraction.scala Maven / Gradle / Ivy

The newest version!
package com.ing.baker.runtime.defaultinteractions

import cats.effect.{IO, Timer}

import scala.concurrent.duration.FiniteDuration

class TimerInteraction(skipWait: Boolean)(implicit timer: Timer[IO]) {

  class TimeWaited()

  def apply(WaitTime: FiniteDuration): IO[TimeWaited] = {
    if(skipWait)
      IO.pure(new TimeWaited)
    else
      IO.sleep(WaitTime) *> IO(new TimeWaited)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy