cron4zio

package cron4zio

Value members

Concrete methods

def getNextRunDuration(cron: Cron, zoneId: ZoneId): IO[IllegalArgumentException, Duration]
Returns

Duration between current time and next run based on cron,zoneId provided or throws IllegalArgumentException if for a valid cron next run cannot be generated

def parse(cron: String): Try[Cron]
Returns

Cron instance, which corresponds to cron expression received as String or throws IllegalArgumentException if expression does not match cron definition

def repeatEffectForCron[R, E >: Throwable, A](effect: ZIO[R, E, A], cron: Cron, maxRecurs: Int, zoneId: ZoneId): ZIO[R & Clock, E, Long]
Returns

This will either return number of times effect ran for cron or will never return anything and keep running forever based on value of param maxRecurs

def repeatEffectsForCron[R, E >: Throwable, A](tasks: List[(ZIO[R, E, A], Cron)], maxRecurs: Int, zoneId: ZoneId): ZIO[R & Clock, E, List[Long]]
Returns

This will either return number of times effects ran for cron or will never return anything and keep running all effects forever based on value of param maxRecurs

def sleepForCron(cron: Cron, zoneId: ZoneId): ZIO[Clock, IllegalArgumentException, Unit]
Returns

Effect which will sleep in non-blocking way for duration between current time and next run

Concrete fields

val cronDefinition: CronDefinition
val cronParser: CronParser