Timer

final case class Timer[A](action: IO[A], delay: FiniteDuration) extends LazyLogging

Utility class capable of delaying the execution of an IO action for a certain duration

This timer can be reset or canceled at any moment

Type parameters:
A

Return type of the scheduled action

Value parameters:
action

Action to be executed when timer delay is over

delay

Wait before executing the action

Source:
Timer.scala
trait Serializable
trait Product
trait Equals
trait LazyLogging
class Object
trait Matchable
class Any

Type members

Types

private type A

Value members

Concrete methods

def cancel(): IO[Unit]

Cancel this timer's countdown, preventing its action from executing

Cancel this timer's countdown, preventing its action from executing

Source:
Timer.scala
def schedule(): IO[Unit]

Start the countdown on this timer, or reset it in case it's already running

Start the countdown on this timer, or reset it in case it's already running

Source:
Timer.scala

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product

Concrete fields

private var actionFiber: Option[FiberIO[A]]

Fiber running the timer action, a reference to this fiber is kept so that it can be cancelled when the timer is reset

Fiber running the timer action, a reference to this fiber is kept so that it can be cancelled when the timer is reset

Source:
Timer.scala
private val delayedAction: IO[A]

The action to be executed by actionFiber, consisting of waiting for delay and then running the action

The action to be executed by actionFiber, consisting of waiting for delay and then running the action

Source:
Timer.scala

Inherited fields

@transient
lazy protected val logger: Logger
Inherited from:
LazyLogging
Source:
Logging.scala