fix: do not raise if deployment does not exist in db

This commit is contained in:
2025-01-13 17:41:14 +01:00
parent ef637cc3a8
commit d1c42aa044

View File

@ -194,6 +194,8 @@ class DataIngestor:
out = self.datasource.db["sessions"].find_one(
{"name": "_default_", "deployment_id": ObjectId(deployment_id)}
)
if out is None:
return None
return out["_id"]
def update_scan_status(self, msg: messages.ScanStatusMessage, deployment_id: str):
@ -215,6 +217,9 @@ class DataIngestor:
if session_id == "_default_":
session_id = self.get_default_session_id(deployment_id)
if session_id is None:
logger.error("Default session not found.")
return
# scans are indexed by the scan_id, hence we can use find_one and search by the ObjectId
data = self.datasource.db["scans"].find_one({"_id": msg.scan_id})