You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add duplicate run prevention and improve database schema
- Replace Run table index with unique constraint on (commit_sha, binary_id, environment_id)
- Add IntegrityError handling in upload endpoint to prevent duplicate runs
- Remove redundant database indexes to improve performance
- Enhance init_db.py with better error handling and database URL override support
- Improve PostgreSQL compatibility with proper table drop ordering
- Add flamegraph cleanup functionality to manage storage efficiently
# Handle unique constraint violation for duplicate commit+binary+environment
300
+
if"unique_commit_binary_env"instr(e).lower():
301
+
logger.error(f"Upload failed: Duplicate run for commit {commit_sha[:8]}, binary '{binary_id}', environment '{environment_id}'")
302
+
raiseHTTPException(
303
+
status_code=409,
304
+
detail=f"A run already exists for commit {commit_sha[:8]} with binary '{binary_id}' and environment '{environment_id}'. Duplicate uploads are not allowed."
305
+
)
306
+
else:
307
+
logger.error(f"Database integrity error during upload: {e}")
0 commit comments