Fix: Add error logging when closing/deleting projects on computes

Previously errors during close() and delete_on_computes() were silently
swallowed without any logging, making it difficult to diagnose failures
when remote computes are unreachable.

- close(): log warning instead of silent pass
- delete_on_computes(): wrap HTTP DELETE in try/except with warning log

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
YueGuobin 2026-05-07 09:37:51 +08:00
parent 4d06b2b7b6
commit 8ecd449dd8
No known key found for this signature in database

View File

@ -890,9 +890,8 @@ class Project:
for compute in list(self._project_created_on_compute):
try:
await compute.post(f"/projects/{self._id}/close", dont_connect=True)
# We don't care if a compute is down at this step
except (ComputeError, ControllerError, TimeoutError):
pass
except (ComputeError, ControllerError, TimeoutError) as e:
log.warning(f"Could not close project '{self._id}' on compute '{compute.id}': {e}")
self._clean_pictures()
self._status = "closed"
if not ignore_notification:
@ -1075,7 +1074,10 @@ class Project:
"""
for compute in list(self._project_created_on_compute):
if compute.id != "local":
await compute.delete(f"/projects/{self._id}")
try:
await compute.delete(f"/projects/{self._id}")
except (ComputeError, TimeoutError) as e:
log.warning(f"Could not delete project '{self._id}' on compute '{compute.id}': {e}")
self._project_created_on_compute.remove(compute)
@classmethod