From 0a67cb45bc44734679f8000a65c2de5052ef610c Mon Sep 17 00:00:00 2001 From: xpltd Date: Sat, 21 Mar 2026 20:23:07 -0500 Subject: [PATCH] Fix session UNIQUE constraint race, fix table horizontal scrollbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - create_session uses INSERT OR IGNORE to handle concurrent requests with same session cookie (race when multiple requests arrive before the first INSERT commits) - Widen actions column 110px→130px to fit 3 action buttons without overflowing (was causing 4px horizontal scrollbar) - Widen status column 100px→120px for DOWNLOADING badge breathing room --- backend/app/core/database.py | 4 ++-- frontend/src/components/DownloadTable.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/core/database.py b/backend/app/core/database.py index 8c23e7f..4c3371e 100644 --- a/backend/app/core/database.py +++ b/backend/app/core/database.py @@ -319,10 +319,10 @@ async def close_db(db: aiosqlite.Connection) -> None: async def create_session(db: aiosqlite.Connection, session_id: str) -> None: - """Insert a new session row.""" + """Insert a new session row (idempotent — ignores duplicates).""" now = datetime.now(timezone.utc).isoformat() await db.execute( - "INSERT INTO sessions (id, created_at, last_seen) VALUES (?, ?, ?)", + "INSERT OR IGNORE INTO sessions (id, created_at, last_seen) VALUES (?, ?, ?)", (session_id, now, now), ) await db.commit() diff --git a/frontend/src/components/DownloadTable.vue b/frontend/src/components/DownloadTable.vue index 1040fd3..2b210e2 100644 --- a/frontend/src/components/DownloadTable.vue +++ b/frontend/src/components/DownloadTable.vue @@ -387,11 +387,11 @@ a.name-with-icon:hover .name-text { min-width: 0; } -.col-status { width: 100px; } +.col-status { width: 120px; white-space: nowrap; } .col-progress { width: 180px; min-width: 120px; } .col-speed { width: 100px; } .col-eta { width: 80px; } -.col-actions { width: 110px; } +.col-actions { width: 130px; } /* Status badges */ .status-badge {