-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from clementguillot/229-cleanup-command-is-fe…
…tching-excessive-data-per-query fix(server): fetch all runs and tasks to delete as streams/flows instead of bulk collections
- Loading branch information
Showing
15 changed files
with
66 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...tence/src/main/kotlin/org/nxcloudce/server/persistence/repository/RunPanacheRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package org.nxcloudce.server.persistence.repository | ||
|
||
import io.quarkus.mongodb.panache.kotlin.reactive.ReactivePanacheMongoRepository | ||
import io.smallrye.mutiny.Uni | ||
import io.smallrye.mutiny.Multi | ||
import jakarta.enterprise.context.ApplicationScoped | ||
import org.nxcloudce.server.persistence.entity.RunEntity | ||
import java.time.LocalDateTime | ||
|
||
@ApplicationScoped | ||
class RunPanacheRepository : ReactivePanacheMongoRepository<RunEntity> { | ||
fun findAllByEndTimeLowerThan(creationDate: LocalDateTime): Uni<List<RunEntity>> { | ||
return find("${RunEntity::endTime.name} < ?1", creationDate).list() | ||
fun findAllByEndTimeLowerThan(creationDate: LocalDateTime): Multi<RunEntity> { | ||
return find("${RunEntity::endTime.name} < ?1", creationDate).stream() | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...ence/src/main/kotlin/org/nxcloudce/server/persistence/repository/TaskPanacheRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
package org.nxcloudce.server.persistence.repository | ||
|
||
import io.quarkus.mongodb.panache.kotlin.reactive.ReactivePanacheMongoRepository | ||
import io.smallrye.mutiny.Multi | ||
import io.smallrye.mutiny.Uni | ||
import jakarta.enterprise.context.ApplicationScoped | ||
import org.bson.types.ObjectId | ||
import org.nxcloudce.server.persistence.entity.TaskEntity | ||
|
||
@ApplicationScoped | ||
class TaskPanacheRepository : ReactivePanacheMongoRepository<TaskEntity> { | ||
fun findAllByRunId(runId: ObjectId): Uni<List<TaskEntity>> = find(TaskEntity::runId.name, runId).list() | ||
fun findAllByRunId(runId: ObjectId): Multi<TaskEntity> = find(TaskEntity::runId.name, runId).stream() | ||
|
||
fun deleteAllByRunId(runId: ObjectId): Uni<Long> = delete(TaskEntity::runId.name, runId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters