two api-replicas with LB-nginx
This commit is contained in:
@@ -11,6 +11,7 @@ from sqlalchemy.exc import DBAPIError, InterfaceError, OperationalError
|
||||
from sqlalchemy.exc import TimeoutError as PoolTimeoutError
|
||||
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
|
||||
from app.core.instance import INSTANCE_ID_HEADER
|
||||
from app.core.request_id import REQUEST_ID_HEADER
|
||||
from app.errors.exceptions import ApiError, internal_error, unavailable
|
||||
|
||||
@@ -43,6 +44,9 @@ def _build_response(
|
||||
**(headers or {}),
|
||||
REQUEST_ID_HEADER: request_id,
|
||||
}
|
||||
instance_id = getattr(request.app.state, "instance_id", None)
|
||||
if instance_id is not None:
|
||||
response_headers[INSTANCE_ID_HEADER] = instance_id
|
||||
|
||||
body = {
|
||||
"error": {
|
||||
|
||||
Reference in New Issue
Block a user