mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-26 12:08:50 +00:00
fixes
This commit is contained in:
parent
e465084c4c
commit
cc60bfb97b
@ -1,18 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.krontab.utils
|
|
||||||
|
|
||||||
internal val monthNumberRegex = Regex("(1[01]?)|(\\d)")
|
|
||||||
internal val dayOfMonthNumberRegex = Regex("(30?)|([012]?\\d)")
|
|
||||||
internal val hoursNumberRegex = Regex("(2[0123]?)|([01]?\\d)")
|
|
||||||
internal val minutesOrSecondsNumberRegex = Regex("[012345]?\\d")
|
|
||||||
|
|
||||||
internal val monthRegex = Regex("[*]|((${monthNumberRegex.pattern})(,(${monthNumberRegex.pattern})){0,10})")
|
|
||||||
internal val dayOfMonthRegex = Regex("[*]|((${dayOfMonthNumberRegex.pattern})(,(${dayOfMonthNumberRegex.pattern})){0,29})")
|
|
||||||
internal val hoursRegex = Regex("[*]|((${hoursNumberRegex.pattern})(,(${hoursNumberRegex.pattern})){0,23})")
|
|
||||||
internal val minutesRegex = Regex("[*]|((${minutesOrSecondsNumberRegex.pattern})(,(${minutesOrSecondsNumberRegex.pattern})){0,59})")
|
|
||||||
internal val secondsRegex = minutesRegex
|
|
||||||
|
|
||||||
internal val monthRange = 0 .. 11
|
|
||||||
internal val dayOfMonthRange = 0 .. 30
|
|
||||||
internal val hoursRange = 0 .. 23
|
|
||||||
internal val minutesRange = 0 .. 59
|
|
||||||
internal val secondsRange = minutesRange
|
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.github.insanusmokrassar.krontab
|
||||||
|
|
||||||
|
suspend inline fun executeWith(
|
||||||
|
scheduler: CronDateTimeScheduler,
|
||||||
|
noinline block: suspend () -> Boolean
|
||||||
|
) = scheduler.doInLoop(block)
|
||||||
|
|
||||||
|
suspend inline fun executeInfinity(
|
||||||
|
scheduleConfig: String,
|
||||||
|
noinline block: suspend () -> Unit
|
||||||
|
) = createCronDateTimeScheduler(scheduleConfig).doInLoop {
|
||||||
|
block()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend inline fun executeWhile(
|
||||||
|
scheduleConfig: String,
|
||||||
|
noinline block: suspend () -> Boolean
|
||||||
|
) = createCronDateTimeScheduler(scheduleConfig).doInLoop(block)
|
||||||
|
|
||||||
|
suspend inline fun executeOnce(
|
||||||
|
scheduleConfig: String,
|
||||||
|
noinline block: suspend () -> Unit
|
||||||
|
) = createCronDateTimeScheduler(scheduleConfig).doInLoop {
|
||||||
|
block()
|
||||||
|
false
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.github.insanusmokrassar.krontab
|
||||||
|
|
||||||
|
internal val monthRange = 0 .. 11
|
||||||
|
internal val dayOfMonthRange = 0 .. 30
|
||||||
|
internal val hoursRange = 0 .. 23
|
||||||
|
internal val minutesRange = 0 .. 59
|
||||||
|
internal val secondsRange = minutesRange
|
@ -1,30 +0,0 @@
|
|||||||
package com.github.insanusmokrassar.krontab
|
|
||||||
|
|
||||||
suspend inline fun executeWith(
|
|
||||||
scheduler: CronDateTimeScheduler,
|
|
||||||
noinline block: suspend () -> Boolean
|
|
||||||
) = scheduler.doInLoop(block)
|
|
||||||
|
|
||||||
suspend fun executeInfinity(scheduleConfig: String, block: suspend () -> Unit) {
|
|
||||||
val scheduler = createCronDateTimeScheduler(scheduleConfig)
|
|
||||||
|
|
||||||
scheduler.doInLoop {
|
|
||||||
block()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun executeWhile(scheduleConfig: String, block: suspend () -> Boolean) {
|
|
||||||
val scheduler = createCronDateTimeScheduler(scheduleConfig)
|
|
||||||
|
|
||||||
scheduler.doInLoop(block)
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun executeOnce(scheduleConfig: String, block: suspend () -> Unit) {
|
|
||||||
val scheduler = createCronDateTimeScheduler(scheduleConfig)
|
|
||||||
|
|
||||||
scheduler.doInLoop {
|
|
||||||
block()
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user