Repository navigation
fix: deletion when blob not found - #3860
Conversation
khangkontum
commented
Dec 22, 2025
- Safe skip deletion when blob not found
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a potential crash when trying to delete a blob that does not exist. The added try...except block makes the delete_syncing_temporal_file function more resilient. My review includes a suggestion to add logging to avoid silently ignoring potentially critical errors, such as a missing bucket. To further improve robustness across the codebase, I recommend auditing other functions in backend/utils/other/storage.py for similar unprotected blob.delete() calls. For example, delete_postprocessing_audio and delete_app_logo could benefit from the same error handling pattern.
| try: | ||
| blob.delete() | ||
| except BlobNotFound: | ||
| pass |
There was a problem hiding this comment.
This try...except block correctly handles a missing blob, but it will also silently suppress a NotFound error if the entire bucket (syncing_local_bucket) does not exist. A missing bucket is a significant configuration error that should likely not be ignored, as it could mask underlying infrastructure problems. At a minimum, logging the error would provide visibility into why the deletion was skipped.
| try: | |
| blob.delete() | |
| except BlobNotFound: | |
| pass | |
| try: | |
| blob.delete() | |
| except BlobNotFound as e: | |
| print(f"INFO: Blob deletion skipped for {file_path}: {e}") |
|
lgtm @khangkontum |
Co-authored-by: Thinh <[email protected]>