diff --git a/metadata-ingestion/src/datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py b/metadata-ingestion/src/datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py index 78b0e68eb5ef9..9ccad559f9eac 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py +++ b/metadata-ingestion/src/datahub/ingestion/source/gc/soft_deleted_entity_cleanup.py @@ -158,14 +158,19 @@ def cleanup_soft_deleted_entities(self) -> None: self.report.num_soft_deleted_entity_removed <= self.config.limit_entities_delete ): - urns = self.ctx.graph.get_urns_by_filter( - entity_types=self.config.entity_types, - platform=self.config.platform, - env=self.config.env, - query=self.config.query, - status=RemovedStatusFilter.ONLY_SOFT_DELETED, - batch_size=self.config.batch_size, + urns = list( + self.ctx.graph.get_urns_by_filter( + entity_types=self.config.entity_types, + platform=self.config.platform, + env=self.config.env, + query=self.config.query, + status=RemovedStatusFilter.ONLY_SOFT_DELETED, + batch_size=self.config.batch_size, + ) ) + if len(urns) == 0: + logger.info("No more urns found") + return futures = {} with ThreadPoolExecutor(max_workers=self.config.max_workers) as executor: