repeatWithSleep

fun repeatWithSleep(iterations: Int, sleepTime: Duration = 1.seconds, block: (count: Int, startMillis: Long) -> Unit)

Repeatedly executes block with a sleep between each iteration.

Parameters

iterations

the number of times to execute the block

sleepTime

the duration to sleep between iterations (default 1 second)

block

the action to invoke, receiving the iteration index and the start time in milliseconds