Kristian Frøhlich
11/29/2024, 8:58 PMprivate suspend fun scheduleWithInitialDelay(job: Job, block: suspend () -> Unit) {
// Repeat every 5 minutes
Schedule.spaced<Unit>(job.fixedInterval)
.delayed { attempt, _ ->
// Delay by 1 minute only for the first attempt
if (attempt == 0L) job.initialDelay else ZERO
}
.repeat { block() }
}
Stylianos Gakis
11/29/2024, 9:11 PMKristian Frøhlich
11/29/2024, 9:27 PMStylianos Gakis
11/29/2024, 10:02 PM