From 4dbffdb2d9f8709d5b36ccd374b3d9e66998ec7d Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 18 Mar 2024 14:52:02 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Queue=E3=81=AE=E5=89=B2=E5=BD=93?= =?UTF-8?q?=E3=81=AB=E5=84=AA=E5=85=88=E9=A0=86=E4=BD=8D=E3=81=8C=E9=81=A9?= =?UTF-8?q?=E7=94=A8=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usbharu/owl/broker/mongodb/MongodbQueuedTaskRepository.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/broker/broker-mongodb/src/main/kotlin/dev/usbharu/owl/broker/mongodb/MongodbQueuedTaskRepository.kt b/broker/broker-mongodb/src/main/kotlin/dev/usbharu/owl/broker/mongodb/MongodbQueuedTaskRepository.kt index 0cfc7f02..343b5c21 100644 --- a/broker/broker-mongodb/src/main/kotlin/dev/usbharu/owl/broker/mongodb/MongodbQueuedTaskRepository.kt +++ b/broker/broker-mongodb/src/main/kotlin/dev/usbharu/owl/broker/mongodb/MongodbQueuedTaskRepository.kt @@ -20,6 +20,7 @@ import com.mongodb.client.model.Filters.* import com.mongodb.client.model.FindOneAndUpdateOptions import com.mongodb.client.model.ReplaceOptions import com.mongodb.client.model.ReturnDocument +import com.mongodb.client.model.Sorts import com.mongodb.client.model.Updates.set import com.mongodb.kotlin.client.coroutine.MongoDatabase import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask @@ -88,7 +89,7 @@ class MongodbQueuedTaskRepository( `in`("task.name", tasks), 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 {