fix(exchange): isolate concurrent connection checks
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 42s
CI/CD Pipeline / Build and Push Images (push) Successful in 20s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 33s

This commit is contained in:
2026-08-10 14:05:44 +02:00
parent 851549587a
commit 2a1f29983e
3 changed files with 28 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
from __future__ import annotations
import json
import uuid
from contextlib import suppress
from typing import Any
@@ -301,7 +302,10 @@ class ExchangeConnectionService:
@classmethod
def _configure_alias(cls, connection: ExchangeConnection) -> str:
alias = f"exchange_target_{connection.id}"
connection_key = (
connection.pk if connection.pk is not None else uuid.uuid4().hex
)
alias = f"exchange_target_{connection_key}"
config = {
"ENGINE": "django.db.backends.postgresql",

View File

@@ -90,8 +90,8 @@ class ExchangeConnectionTestView(APIView):
tags=[EXCHANGE_TAG],
operation_summary="Проверить подключение",
operation_description=(
"Проверяет подключение и структуру целевой БД без сохранения "
"настроек подключения."
"Проверяет доступность PostgreSQL и учетные данные без сохранения "
"настроек подключения. Проверка структуры выполняется при сохранении."
),
request_body=ExchangeConnectionCreateSerializer,
responses={