优化数据库查询布局

This commit is contained in:
CN-JS-HuiBai
2026-04-12 17:48:43 +08:00
parent b79cb09987
commit e60fa2b982
5 changed files with 136 additions and 94 deletions

View File

@@ -64,12 +64,12 @@ function createClient(baseUrl) {
/**
* Test Prometheus connection
*/
async function testConnection(url) {
async function testConnection(url, customTimeout = null) {
const normalized = normalizeUrl(url);
try {
// Using native fetch to avoid follow-redirects/axios "protocol mismatch" issues in some Node environments
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), QUERY_TIMEOUT);
const timer = setTimeout(() => controller.abort(), customTimeout || QUERY_TIMEOUT);
// Node native fetch - handles http/https automatically
const res = await fetch(`${normalized}/api/v1/status/buildinfo`, {