fix: connection pool exhaustion + cross_ref column name

- tenant_db.py: add rollback() before returning conn to pool to prevent
  'idle in transaction (aborted)' state that exhausts the pool
- tenant_db.py: increase pool maxconn from 10 to 20 for better concurrency
- inventory_vehicle_compat.py: fix column name cross_ref_number ->
  cross_reference_number to match actual schema
This commit is contained in:
2026-05-01 02:25:58 +00:00
parent 2b418701b6
commit 0e549e7746
2 changed files with 13 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ def auto_match_vehicle_compatibility(master_conn, tenant_conn, inventory_id, par
Searches:
1. parts.oem_part_number (exact, case-insensitive, spaces stripped)
2. aftermarket_parts.part_number
3. part_cross_references.cross_ref_number
3. part_cross_references.cross_reference_number
Returns:
dict: {'matched': bool, 'matches': [...], 'myes': [...]}
@@ -46,7 +46,7 @@ def auto_match_vehicle_compatibility(master_conn, tenant_conn, inventory_id, par
if not oem_ids:
cur.execute("""
SELECT DISTINCT part_id FROM part_cross_references
WHERE REPLACE(UPPER(cross_ref_number), ' ', '') = %s
WHERE REPLACE(UPPER(cross_reference_number), ' ', '') = %s
""", (clean_pn,))
oem_ids = [r[0] for r in cur.fetchall() if r[0]]