From 614e6462e28c7ab013b669d7a7b2cc9c996a0a3f Mon Sep 17 00:00:00 2001
From: rabbitali <shusheng.wen@outlook.com>
Date: Wed, 28 Jun 2023 11:57:38 +0800
Subject: [PATCH 1/1] fix issue:gen cve task failed

---
 apollo/database/proxy/task.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/apollo/database/proxy/task.py b/apollo/database/proxy/task.py
index dd172b8..ed5e858 100644
--- a/apollo/database/proxy/task.py
+++ b/apollo/database/proxy/task.py
@@ -3224,8 +3224,9 @@ class TaskProxy(TaskMysqlProxy, TaskEsProxy):
         """
 
         try:
-            exists_cve_count = self.session.query(CveHostAssociation).filter(
-                CveHostAssociation.cve_id.in_(cve_id)).count()
+            exists_cve_count = self.session.query(CveHostAssociation.cve_id).filter(
+                CveHostAssociation.cve_id.in_(cve_id)).distinct().count()
+
 
             return True if exists_cve_count == len(cve_id) else False
         except SQLAlchemyError as error:
-- 
2.33.0

