Update src/main/kotlin/dev/usbharu/hideout/core/infrastructure/kjobexposed/ExposedJobRepository.kt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
usbharu 2024-02-18 12:32:31 +09:00 committed by GitHub
parent 93266c1d35
commit fe3efc5fbf
1 changed files with 1 additions and 2 deletions

View File

@ -92,8 +92,7 @@ class ExposedJobRepository(
@Suppress("SuspendFunWithFlowReturnType") @Suppress("SuspendFunWithFlowReturnType")
override suspend fun findNext(names: Set<String>, status: Set<JobStatus>, limit: Int): Flow<ScheduledJob> { override suspend fun findNext(names: Set<String>, status: Set<JobStatus>, limit: Int): Flow<ScheduledJob> {
return query { return query {
jobs.selectAll( jobs.selectAll().where(
).where(
jobs.status.inList(list = status.map { it.name }) jobs.status.inList(list = status.map { it.name })
.and(if (names.isEmpty()) Op.TRUE else jobs.name.inList(names)) .and(if (names.isEmpty()) Op.TRUE else jobs.name.inList(names))
).limit(limit) ).limit(limit)