feat(settings): run Traefik setup in background to prevent proxy timeouts

- Modified the Traefik setup call to execute in the background, allowing immediate response to the client.
- Added error handling to log any issues during the background execution of the Traefik setup.
This commit is contained in:
Mauricio Siu
2026-02-07 00:34:43 -06:00
parent 3750cdab44
commit aa2e0e81c6

View File

@@ -158,10 +158,14 @@ export const settingsRouter = createTRPCRouter({
newPorts = ports.filter((port) => port.targetPort !== 8080);
}
await writeTraefikSetup({
// Run in background so the request returns immediately; client polls /api/health.
// Avoids proxy timeouts (520) while Traefik is recreated.
void writeTraefikSetup({
env: preparedEnv,
additionalPorts: newPorts,
serverId: input.serverId,
}).catch((err) => {
console.error("toggleDashboard background writeTraefikSetup:", err);
});
return true;
}),