Add S3 configuration options and improved error handling
- Add s3_verify_ssl config option for SSL/TLS verification - Add s3_connect_timeout and s3_read_timeout config options - Add s3_max_retries config option with adaptive retry mode - Add S3StorageUnavailableError for backend availability issues - Add HashCollisionError for detecting extremely rare hash collisions - Add hash collision detection by comparing file sizes on dedup - Handle network interruption and timeout errors explicitly - Update routes.py to handle new exception types with appropriate HTTP codes
This commit is contained in:
@@ -29,6 +29,8 @@ from .storage import (
|
||||
HashComputationError,
|
||||
S3ExistenceCheckError,
|
||||
S3UploadError,
|
||||
S3StorageUnavailableError,
|
||||
HashCollisionError,
|
||||
)
|
||||
from .models import (
|
||||
Project,
|
||||
@@ -998,6 +1000,19 @@ def upload_artifact(
|
||||
status_code=503,
|
||||
detail="Storage service temporarily unavailable. Please retry.",
|
||||
)
|
||||
except S3StorageUnavailableError as e:
|
||||
logger.error(f"S3 storage unavailable: {e}")
|
||||
raise HTTPException(
|
||||
status_code=503,
|
||||
detail="Storage backend is unavailable. Please retry later.",
|
||||
)
|
||||
except HashCollisionError as e:
|
||||
# This is extremely rare - log critical alert
|
||||
logger.critical(f"HASH COLLISION DETECTED: {e}")
|
||||
raise HTTPException(
|
||||
status_code=500,
|
||||
detail="Data integrity error detected. Please contact support.",
|
||||
)
|
||||
except StorageError as e:
|
||||
logger.error(f"Storage error during upload: {e}")
|
||||
raise HTTPException(status_code=500, detail="Internal storage error")
|
||||
|
||||
Reference in New Issue
Block a user