alon shoshani.86
12/23/2021, 8:57 AMsimon.vergauwen
12/23/2021, 8:58 AMfun Application.task(): Job = launch {
Schedule.spaced<Unit>(1.minutes).repeat {
// Run task
}
}
alon shoshani.86
12/23/2021, 9:35 AMrunBlocking {
Schedule.spaced<Unit>(5.minutes).repeat {
<http://log.info|log.info> { "here" }
}
}
simon.vergauwen
12/23/2021, 10:52 AMApplication
from Ktor
which is a CoroutineScope
, and then you can launch
the Job
with the same lifecycle as your Ktor server.fun Application.task(): Job = launch {
Schedule.spaced<Unit>(1.minutes).repeat {
// Run task
}
}
Application
here is Ktor
Application