diff --git a/backend/btrixcloud/operator/crawls.py b/backend/btrixcloud/operator/crawls.py index 172af560..a473a376 100644 --- a/backend/btrixcloud/operator/crawls.py +++ b/backend/btrixcloud/operator/crawls.py @@ -1381,6 +1381,7 @@ class CrawlOperator(BaseOperator): ) for key, value in sizes.items(): + increase_storage = False value = int(value) if value > 0 and status.podStatus: pod_info = status.podStatus[key] @@ -1393,15 +1394,21 @@ class CrawlOperator(BaseOperator): and pod_info.used.storage * self.min_avail_storage_ratio > pod_info.allocated.storage ): - new_storage = math.ceil( - pod_info.used.storage - * self.min_avail_storage_ratio - / 1_000_000_000 - ) - pod_info.newStorage = f"{new_storage}Gi" - print( - f"Attempting to adjust storage to {pod_info.newStorage} for {key}" - ) + increase_storage = True + + # out of storage + if pod_info.isNewExit and pod_info.exitCode == 3: + pod_info.used.storage = pod_info.allocated.storage + increase_storage = True + + if increase_storage: + new_storage = math.ceil( + pod_info.used.storage * self.min_avail_storage_ratio / 1_000_000_000 + ) + pod_info.newStorage = f"{new_storage}Gi" + print( + f"Attempting to adjust storage to {pod_info.newStorage} for {key}" + ) if not status.stopReason: status.stopReason = await self.is_crawl_stopping(crawl, status, data)