Skip to content

Instantly share code, notes, and snippets.

@karthik-mtap
karthik-mtap / Schedule.kt
Created February 8, 2019 10:26
Call the UseCase in a scheduled time interval.
import kotlin.concurrent.timer
fun schedule(taskName: String, intervalInSecs: Long, codeBlock: () -> Unit) {
timer("task_name", false, 0, intervalInSecs * 1000) {
codeBlock()
}
}
fun main(args: Array<String>) {