schedule
suspend fun schedule(seconds: Long, startNow: Boolean = true, name: String? = null, pollingSeconds: Long = 1, repeat: Boolean = false, callback: suspend () -> Unit): Task
Convenience function to schedule a Task using seconds instead of a Duration.
suspend fun schedule(delay: Duration, startNow: Boolean = true, name: String? = null, pollingSeconds: Long = 1, repeat: Boolean = false, callback: suspend () -> Unit): Task
Schedule a Task using the given delay and callback. A name will be generated if not provided.
Parameters
delay
Duration object representing the time to wait for.
startNow
Whether to start the task now - false if you want to start it yourself.
name
Optional task name, used in logging.
pollingSeconds
How often to check whether enough time has passed - 1 by default.
repeat
Whether to repeat the task indefinitely - false by default.
callback
Callback to run when the task has waited for long enough.