From 1e921b40847eee53189deb7dc69c7bdb438a7d31 Mon Sep 17 00:00:00 2001 From: Rodrigo Bertoldo de Sousa Martins Date: Tue, 8 Sep 2026 13:25:12 -0300 Subject: [PATCH] fix4 --- frontend/src/hooks/useSystemStructures.ts | 24 ++++++++++++++--------- nginx/nginx.conf | 6 +++++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/frontend/src/hooks/useSystemStructures.ts b/frontend/src/hooks/useSystemStructures.ts index 8be17a1..5f664dd 100644 --- a/frontend/src/hooks/useSystemStructures.ts +++ b/frontend/src/hooks/useSystemStructures.ts @@ -17,15 +17,21 @@ export function useSystemStructures(visibleSystems: Set) { if (missing.length === 0) return; let cancelled = false; - Promise.all( - missing.map((slug) => - api.structures({ system: slug }).then((data) => [slug, data] as const), - ), - ).then((pairs) => { - if (cancelled) return; - for (const [slug, data] of pairs) cacheRef.current.set(slug, data); - bump(); - }); + // Cada sistema atualiza o cache assim que a SUA própria resposta chega + // — um sistema lento/travado (ex: um com muito mais estruturas) não + // pode impedir os outros de aparecerem (Promise.all faria isso). + for (const slug of missing) { + api + .structures({ system: slug }) + .then((data) => { + if (cancelled) return; + cacheRef.current.set(slug, data); + bump(); + }) + .catch((err) => { + console.error(`Falha ao carregar estruturas de "${slug}":`, err); + }); + } return () => { cancelled = true; diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 83b2654..2a7bcc2 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -30,7 +30,11 @@ http { # worker sobe e cachear esse IP para sempre — sem isso, recriar o # container anatomia-api (rebuild, restart) muda o IP dele e o nginx # continua batendo no IP antigo até ser reiniciado manualmente. - resolver 127.0.0.11 valid=10s; + # ipv6=off: a rede "dockernet" atribui IPv6 aos containers, mas o + # caminho IPv6 entre eles parece sem rota nesse host (a conexão via + # AAAA ora falha rápido com "Connection refused", ora fica pendurada + # até estourar o timeout) — forçamos resolução só por IPv4 (A records). + resolver 127.0.0.11 valid=10s ipv6=off; location /api/ { set $api_upstream anatomia-api:3333;