Run jobs every hour instead of every day
This commit is contained in:
parent
62eb6b0976
commit
7754bfaae5
1 changed files with 2 additions and 5 deletions
|
@ -19,14 +19,12 @@ import kotlinx.coroutines.delay
|
|||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.ExperimentalTime
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
fun main(args: Array<String>): Unit = io.ktor.server.cio.EngineMain.main(args)
|
||||
|
||||
private const val DATABASE_VERSION = 2
|
||||
|
||||
@ExperimentalTime
|
||||
fun Application.module() {
|
||||
val dbHost = environment.config.propertyOrNull("twigs.database.host")?.getString() ?: "localhost"
|
||||
val dbPort = environment.config.propertyOrNull("twigs.database.port")?.getString() ?: "5432"
|
||||
|
@ -52,7 +50,6 @@ fun Application.module() {
|
|||
}
|
||||
}
|
||||
|
||||
@ExperimentalTime
|
||||
fun Application.moduleWithDependencies(
|
||||
metadataRepository: MetadataRepository,
|
||||
budgetRepository: BudgetRepository,
|
||||
|
@ -139,7 +136,7 @@ fun Application.moduleWithDependencies(
|
|||
)
|
||||
while (currentCoroutineContext().isActive) {
|
||||
jobs.forEach { it.run() }
|
||||
delay(Duration.hours(24))
|
||||
delay(TimeUnit.HOURS.toMillis(1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue