fix(traffic): загружать данные потоков последовательно
This commit is contained in:
1 parent
b4d2d4bc20
commit
3d5b7f0ea6
1 file changed
+9
-6
@@ -924,18 +924,21 @@ export default function TrafficPage() {
|
||||
})
|
||||
return () => { cancelled = true }
|
||||
}
|
||||
void Promise.all([
|
||||
getTrafficFlows(backendUrl, range),
|
||||
getFlowExporters(backendUrl, range),
|
||||
getFlowClients(backendUrl, range),
|
||||
]).then(([stats, exporters, clients]) => {
|
||||
const loadFlowCards = async () => {
|
||||
// These reads share the collector's constrained admission budget.
|
||||
const stats = await getTrafficFlows(backendUrl, range)
|
||||
if (cancelled) return
|
||||
const exporters = await getFlowExporters(backendUrl, range)
|
||||
if (cancelled) return
|
||||
const clients = await getFlowClients(backendUrl, range)
|
||||
if (cancelled) return
|
||||
setFlowResult({ key: flowKey, receivedAt: Date.now(), stats, exporters: exporters.exporters, clients: clients.clients })
|
||||
setSelectedId(prev => {
|
||||
const list = flowScope === "users" ? clients.clients : exporters.exporters
|
||||
return list.some(x => x.id === prev) ? prev : (list[0]?.id ?? "")
|
||||
})
|
||||
}).catch(e => {
|
||||
}
|
||||
void loadFlowCards().catch(e => {
|
||||
if (!cancelled) setFlowResult({ key: flowKey, error: e instanceof Error ? e.message : "Не удалось загрузить потоки" })
|
||||
})
|
||||
return () => { cancelled = true }
|
||||
|
||||
Reference in new issue
Block a user