Merge branch 'feat/tidb-endpoint' of github.com:langgenius/dify into feat/tidb-endpoint

This commit is contained in:
Yansong Zhang 2026-04-15 11:42:26 +08:00
commit b2d5799b82
2 changed files with 17 additions and 8 deletions

View File

@ -109,7 +109,9 @@ class TidbService:
qdrant_endpoint = TidbService.fetch_qdrant_endpoint(api_url, public_key, private_key, cluster_id) qdrant_endpoint = TidbService.fetch_qdrant_endpoint(api_url, public_key, private_key, cluster_id)
logger.info( logger.info(
"Cluster %s is ACTIVE, user_prefix=%s, qdrant_endpoint=%s", "Cluster %s is ACTIVE, user_prefix=%s, qdrant_endpoint=%s",
cluster_id, user_prefix, qdrant_endpoint, cluster_id,
user_prefix,
qdrant_endpoint,
) )
return { return {
"cluster_id": cluster_id, "cluster_id": cluster_id,
@ -118,7 +120,13 @@ class TidbService:
"password": password, "password": password,
"qdrant_endpoint": qdrant_endpoint, "qdrant_endpoint": qdrant_endpoint,
} }
logger.info("Cluster %s state=%s, retry %d/%d", cluster_id, cluster_response["state"], retry_count + 1, max_retries) logger.info(
"Cluster %s state=%s, retry %d/%d",
cluster_id,
cluster_response["state"],
retry_count + 1,
max_retries,
)
time.sleep(30) time.sleep(30)
retry_count += 1 retry_count += 1
logger.error("Cluster %s did not become ACTIVE after %d retries", cluster_id, max_retries) logger.error("Cluster %s did not become ACTIVE after %d retries", cluster_id, max_retries)
@ -295,12 +303,11 @@ class TidbService:
if not cached_password: if not cached_password:
logger.warning("No cached password for cluster %s, skipping", item["displayName"]) logger.warning("No cached password for cluster %s, skipping", item["displayName"])
continue continue
qdrant_endpoint = TidbService.fetch_qdrant_endpoint( qdrant_endpoint = TidbService.fetch_qdrant_endpoint(api_url, public_key, private_key, item["clusterId"])
api_url, public_key, private_key, item["clusterId"]
)
logger.info( logger.info(
"Batch cluster %s: qdrant_endpoint=%s", "Batch cluster %s: qdrant_endpoint=%s",
item["clusterId"], qdrant_endpoint, item["clusterId"],
qdrant_endpoint,
) )
cluster_info = { cluster_info = {
"cluster_id": item["clusterId"], "cluster_id": item["clusterId"],

View File

@ -445,7 +445,8 @@ class TidbOnQdrantVectorFactory(AbstractVectorFactory):
if idle_tidb_auth_binding: if idle_tidb_auth_binding:
logger.info( logger.info(
"Assigning idle cluster %s to tenant %s", "Assigning idle cluster %s to tenant %s",
idle_tidb_auth_binding.cluster_id, dataset.tenant_id, idle_tidb_auth_binding.cluster_id,
dataset.tenant_id,
) )
idle_tidb_auth_binding.active = True idle_tidb_auth_binding.active = True
idle_tidb_auth_binding.tenant_id = dataset.tenant_id idle_tidb_auth_binding.tenant_id = dataset.tenant_id
@ -464,7 +465,8 @@ class TidbOnQdrantVectorFactory(AbstractVectorFactory):
) )
logger.info( logger.info(
"New cluster created: cluster_id=%s, qdrant_endpoint=%s", "New cluster created: cluster_id=%s, qdrant_endpoint=%s",
new_cluster["cluster_id"], new_cluster.get("qdrant_endpoint"), new_cluster["cluster_id"],
new_cluster.get("qdrant_endpoint"),
) )
new_tidb_auth_binding = TidbAuthBinding( new_tidb_auth_binding = TidbAuthBinding(
cluster_id=new_cluster["cluster_id"], cluster_id=new_cluster["cluster_id"],