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

spice.maintenance.MaintenanceTask.scala Maven / Gradle / Ivy

There is a newer version: 0.7.2
Show newest version
package spice.maintenance

import cats.effect.IO

import scala.concurrent.duration.FiniteDuration

trait MaintenanceTask {
  def name: String = getClass.getSimpleName.replace("$", "")

  def nextRun: FiniteDuration

  def initialDelay: FiniteDuration = nextRun

  def onFail: TaskResult = TaskResult.Continue

  def apply(status: TaskStatus): IO[TaskResult]

  def schedule(): MaintenanceTaskInstance = Maintenance.schedule(
    name = name,
    schedule = nextRun,
    initialDelay = Some(initialDelay),
    onFail = onFail
  )(apply)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy