Skip to content

Commit

Permalink
#1738 Optimize alertAlreadyImportes query
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jan 11, 2021
1 parent 4283406 commit 64d4147
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ScalliGraph
4 changes: 2 additions & 2 deletions thehive/app/org/thp/thehive/services/AlertSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 64d4147

Please sign in to comment.