InsanusMokrassar / krontab

Library for using Crontab-like syntax in scheduling of some Kotlin Coroutines tasks to do from time to time
https://docs.inmo.dev/krontab/index.html
Apache License 2.0
101 stars 6 forks source link

`java.time.Duration` as a time period? #26

Open mangatmodi opened 2 years ago

mangatmodi commented 2 years ago

Thanks for the amazing library. Do you see value in providing an API to schedule the task with a java.time.Duration time period? I understand that it is not exactly a crontab format.

I could contribute if you agree to the proposal.

github-actions[bot] commented 2 years ago

Welcome with your first issue

InsanusMokrassar commented 2 years ago

Hello, thanks for your issue :) No, I still didn't thought about it, but I will :) thank yiu for an idea

InsanusMokrassar commented 2 years ago

Hello again :) sorry for that delay. Currently it looks like you want something like this:

val kronScheduler = buildScheduler(Duration.ofSeconds(1L))
kronScheduler.doInfinity {
    println(it) // will print each second
}

Is it how do you see future realization?

InsanusMokrassar commented 2 years ago

Closed due to inactivity and unclear state of issue idea

mangatmodi commented 1 year ago

Hey I apologise. I took a long timeoff from coding. I am back now. Yes. Your idea is perfectly what I meant. To be honest, I tried to do it myself, but I didn't reach anywhere.

Any chance to open up the ticket? I will be happy to help too, if you could point me in the right direction.

InsanusMokrassar commented 1 year ago

Hi :) glad to see you again :) Issue is open. If you want, you may try to create new KronScheduler and use it in buildScheduler based on Duration