mirror of https://github.com/usbharu/Hideout.git
feat: Queueの割当に優先順位が適用されるように
This commit is contained in:
parent
cbfcc21dee
commit
4dbffdb2d9
|
@ -20,6 +20,7 @@ import com.mongodb.client.model.Filters.*
|
||||||
import com.mongodb.client.model.FindOneAndUpdateOptions
|
import com.mongodb.client.model.FindOneAndUpdateOptions
|
||||||
import com.mongodb.client.model.ReplaceOptions
|
import com.mongodb.client.model.ReplaceOptions
|
||||||
import com.mongodb.client.model.ReturnDocument
|
import com.mongodb.client.model.ReturnDocument
|
||||||
|
import com.mongodb.client.model.Sorts
|
||||||
import com.mongodb.client.model.Updates.set
|
import com.mongodb.client.model.Updates.set
|
||||||
import com.mongodb.kotlin.client.coroutine.MongoDatabase
|
import com.mongodb.kotlin.client.coroutine.MongoDatabase
|
||||||
import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask
|
import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask
|
||||||
|
@ -88,7 +89,7 @@ class MongodbQueuedTaskRepository(
|
||||||
`in`("task.name", tasks),
|
`in`("task.name", tasks),
|
||||||
eq(QueuedTaskMongodb::isActive.name, true)
|
eq(QueuedTaskMongodb::isActive.name, true)
|
||||||
)
|
)
|
||||||
).map { it.toQueuedTask(propertySerializerFactory) }.flowOn(Dispatchers.IO)
|
).sort(Sorts.descending("priority")).map { it.toQueuedTask(propertySerializerFactory) }.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findByQueuedAtBeforeAndIsActiveIsTrue(instant: Instant): Flow<QueuedTask> {
|
override fun findByQueuedAtBeforeAndIsActiveIsTrue(instant: Instant): Flow<QueuedTask> {
|
||||||
|
|
Loading…
Reference in New Issue