perf(startup): skip inactive background services
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { enableTunnel } from "@/lib/tunnel";
|
||||
import { getSettings } from "@/lib/localDb";
|
||||
import { configureTunnelMonitoring } from "@/shared/services/initializeApp";
|
||||
|
||||
const DNS_WARMUP_DELAY_MS = 8000;
|
||||
|
||||
export async function POST() {
|
||||
try {
|
||||
const result = await enableTunnel();
|
||||
getSettings()
|
||||
.then(configureTunnelMonitoring)
|
||||
.catch((error) => console.warn("Tunnel monitor start failed:", error.message));
|
||||
// Wait for DNS warmup to propagate at Cloudflare edge after tunnel registered
|
||||
await new Promise((r) => setTimeout(r, DNS_WARMUP_DELAY_MS));
|
||||
return NextResponse.json(result);
|
||||
|
||||
Reference in New Issue
Block a user