fix(exchange): isolate concurrent connection checks
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -90,8 +90,8 @@ class ExchangeConnectionTestView(APIView):
|
||||
tags=[EXCHANGE_TAG],
|
||||
operation_summary="Проверить подключение",
|
||||
operation_description=(
|
||||
"Проверяет подключение и структуру целевой БД без сохранения "
|
||||
"настроек подключения."
|
||||
"Проверяет доступность PostgreSQL и учетные данные без сохранения "
|
||||
"настроек подключения. Проверка структуры выполняется при сохранении."
|
||||
),
|
||||
request_body=ExchangeConnectionCreateSerializer,
|
||||
responses={
|
||||
|
||||
Reference in New Issue
Block a user