Merge branch 'master' of https://gitapp.workolik.com/nearle_daily/catalogue_backend
This commit is contained in:
@@ -42,6 +42,8 @@ actually resolves to real image bytes above a minimum size - this is what
|
||||
stops garbage/placeholder/expired URLs from reaching the S3 upload step
|
||||
and failing there silently.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional, List
|
||||
import requests
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Dict, Any, Optional
|
||||
import json
|
||||
import re
|
||||
|
||||
@@ -9,7 +9,10 @@ import re
|
||||
import time
|
||||
import psycopg
|
||||
|
||||
from app.infrastructure.settings import DATABASE_URL, USE_PGVECTOR, DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
|
||||
from app.infrastructure.settings import (
|
||||
DATABASE_URL, USE_PGVECTOR, DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD,
|
||||
DB_CONNECT_TIMEOUT_SECONDS,
|
||||
)
|
||||
from app.services.brand_registry import BRAND_ALIASES, resolve_parent_brand
|
||||
|
||||
|
||||
@@ -93,7 +96,15 @@ def _connect() -> Optional[psycopg.Connection]:
|
||||
dbname=DB_NAME,
|
||||
user=DB_USER,
|
||||
password=DB_PASSWORD,
|
||||
autocommit=True
|
||||
autocommit=True,
|
||||
# Without this, a host that DROPS packets rather than refusing them
|
||||
# - a firewall, a wrong DB_HOST - blocks here until the OS gives up,
|
||||
# which is around 130 seconds on Linux. Every caller of _connect()
|
||||
# inherits that: /api/health stops answering, the container's
|
||||
# healthcheck times out, and the platform pulls the service out of
|
||||
# its load balancer. "Database unreachable" then presents as a Bad
|
||||
# Gateway on every route, including ones that never touch the DB.
|
||||
connect_timeout=DB_CONNECT_TIMEOUT_SECONDS,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Vector DB connection failed: {e}")
|
||||
|
||||
Reference in New Issue
Block a user