feat: Optimize server availability checks with parallelized TCP connections and in-memory caching, and update Dashboard to handle paginated API responses for improved performance and user experience
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 6m47s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 6m47s
This commit is contained in:
+26
-10
@@ -80,11 +80,11 @@ function Dashboard() {
|
||||
try {
|
||||
// Загружаем данные с обработкой ошибок для каждого endpoint
|
||||
const results = await Promise.allSettled([
|
||||
axios.get('/api/domains-new'),
|
||||
axios.get('/api/ip-ranges'),
|
||||
axios.get('/api/asns'),
|
||||
axios.get('/api/domains-new', { params: { offset: 0, limit: 1 } }),
|
||||
axios.get('/api/ip-ranges', { params: { offset: 0, limit: 1 } }),
|
||||
axios.get('/api/asns', { params: { offset: 0, limit: 1 } }),
|
||||
axios.get('/api/servers'),
|
||||
axios.get('/api/servers/availability'),
|
||||
axios.get('/api/servers/availability', { params: { ttlSeconds: 60 } }),
|
||||
axios.get('/api/s3/last-modified')
|
||||
]);
|
||||
|
||||
@@ -97,9 +97,15 @@ function Dashboard() {
|
||||
const s3Res = results[5];
|
||||
|
||||
// Получаем данные серверов для подсчета дополнительной статистики
|
||||
const domains = domainsRes.status === 'fulfilled' ? domainsRes.value.data : [];
|
||||
const ipRanges = ipRangesRes.status === 'fulfilled' ? ipRangesRes.value.data : [];
|
||||
const asns = asnsRes.status === 'fulfilled' ? asnsRes.value.data : [];
|
||||
const domains = domainsRes.status === 'fulfilled'
|
||||
? (Array.isArray(domainsRes.value.data?.items) ? domainsRes.value.data.items : domainsRes.value.data)
|
||||
: [];
|
||||
const ipRanges = ipRangesRes.status === 'fulfilled'
|
||||
? (Array.isArray(ipRangesRes.value.data?.items) ? ipRangesRes.value.data.items : ipRangesRes.value.data)
|
||||
: [];
|
||||
const asns = asnsRes.status === 'fulfilled'
|
||||
? (Array.isArray(asnsRes.value.data?.items) ? asnsRes.value.data.items : asnsRes.value.data)
|
||||
: [];
|
||||
const servers = serversRes.status === 'fulfilled' ? serversRes.value.data : [];
|
||||
setRaw({ domains, ipRanges, asns, servers });
|
||||
const countries = new Set(servers.map(server => server.country).filter(Boolean));
|
||||
@@ -111,10 +117,20 @@ function Dashboard() {
|
||||
const lmRaw = s3Res.status === 'fulfilled' ? s3Res.value.data?.domainsNew?.lastModified : null;
|
||||
const lastModified = lmRaw ? new Date(lmRaw).toLocaleString() : new Date().toLocaleString();
|
||||
|
||||
const domainsCount = domainsRes.status === 'fulfilled' && typeof domainsRes.value.data?.total === 'number'
|
||||
? domainsRes.value.data.total
|
||||
: domains.length;
|
||||
const ipRangesCount = ipRangesRes.status === 'fulfilled' && typeof ipRangesRes.value.data?.total === 'number'
|
||||
? ipRangesRes.value.data.total
|
||||
: ipRanges.length;
|
||||
const asnsCount = asnsRes.status === 'fulfilled' && typeof asnsRes.value.data?.total === 'number'
|
||||
? asnsRes.value.data.total
|
||||
: asns.length;
|
||||
|
||||
setStats({
|
||||
domainsCount: domains.length,
|
||||
ipRangesCount: ipRanges.length,
|
||||
asnsCount: asns.length,
|
||||
domainsCount,
|
||||
ipRangesCount,
|
||||
asnsCount,
|
||||
serversCount: servers.length,
|
||||
lastModified,
|
||||
countriesCount: countries.size,
|
||||
|
||||
Reference in New Issue
Block a user