#524 [API/Race] App installation duplicate on concurrent request

closed medium Created 2025-12-17 15:00 · Updated 2025-12-17 15:54

Description

Edit
**File:** api/blueprints/v1/tenant_apps.py:174-200 **Problem:** Check for existing installation (SELECT) then INSERT is not atomic. Two concurrent installs can both pass the SELECT check, then one fails with duplicate key error (500) instead of 409 conflict. **Fix:** Catch UniqueViolation: ```python try: cur.execute("INSERT INTO highway.tenant_app_installations ...") except psycopg.errors.UniqueViolation: return error_response("App is already installed", status_code=409, code="APP_ALREADY_INSTALLED") ``` **Impact:** 500 errors on concurrent app installations.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...