fix: admin/internet: timeout #437
Massimo Melina committed
Jan 9, 2024 at 17:11 UTC
322dd7d04b50a7cc6c3a8ef69ae2f5d86bd25c33
2 files changed
+2
-2
admin/src/InternetPage.ts
+1
-1
@@ -32,7 +32,7 @@ export default function InternetPage() {
32
const localColor = with_([status.data?.http?.error, status.data?.https?.error], ([h, s]) =>
33
h && s ? 'error' : h || s ? 'warning' : 'success')
34
type GetNat = Awaited<ReturnType<typeof getNatInfo>>
35
- const nat = useApiEx<GetNat>('get_nat')
35
+ const nat = useApiEx<GetNat>('get_nat', {}, { timeout: 20 })
36
const { data } = nat
37
const port = data?.internalPort
38
const wrongMap = data?.mapped && data.mapped.private.port !== port && data.mapped.private.port
src/nat.ts
+1
-1
@@ -51,7 +51,7 @@ const getPublicIps = debounceAsync(async () => {
51
svc = { type: 'http', url: svc }
52
console.debug("trying ip service", svc.url || svc.name)
53
if (svc.type === 'http')
54
- return httpString(svc.url)
54
+ return httpString(svc.url, { timeout: 5_000 })
55
if (svc.type !== 'dns') throw "unsupported"
56
const resolver = new Resolver({ timeout: 2_000 })
57
resolver.setServers(svc.ips)