From 64d4147d75469a638cb3b966133dd620e3efce65 Mon Sep 17 00:00:00 2001 From: To-om Date: Mon, 11 Jan 2021 11:28:48 +0100 Subject: [PATCH] #1738 Optimize alertAlreadyImportes query --- ScalliGraph | 2 +- thehive/app/org/thp/thehive/services/AlertSrv.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ScalliGraph b/ScalliGraph index acc3bea235..33fcd753fa 160000 --- a/ScalliGraph +++ b/ScalliGraph @@ -1 +1 @@ -Subproject commit acc3bea235989e57f8b43fd0780f6905437cc9e2 +Subproject commit 33fcd753fa102062ab54411fef169c847f1501db diff --git a/thehive/app/org/thp/thehive/services/AlertSrv.scala b/thehive/app/org/thp/thehive/services/AlertSrv.scala index 082fa64ee6..f18809bd4f 100644 --- a/thehive/app/org/thp/thehive/services/AlertSrv.scala +++ b/thehive/app/org/thp/thehive/services/AlertSrv.scala @@ -72,8 +72,8 @@ class AlertSrv @Inject() ( graph: Graph, authContext: AuthContext ): Try[RichAlert] = { - val alertAlreadyExist = organisationSrv.get(organisation).alerts.getBySourceId(alert.`type`, alert.source, alert.sourceRef).getCount - if (alertAlreadyExist > 0) + val alertAlreadyExist = startTraversal.getBySourceId(alert.`type`, alert.source, alert.sourceRef).organisation.current.exists + if (alertAlreadyExist) Failure(CreateError(s"Alert ${alert.`type`}:${alert.source}:${alert.sourceRef} already exist in organisation ${organisation.name}")) else for {