From 04ab968e0f7962f68fbcb03aeef6c4646205fa1f Mon Sep 17 00:00:00 2001 From: Chris Wanstrath <2+defunkt@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:19:24 -0700 Subject: [PATCH] fix ports --- src/webapp/server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/webapp/server.ts b/src/webapp/server.ts index bd12792..26ec1cf 100644 --- a/src/webapp/server.ts +++ b/src/webapp/server.ts @@ -16,7 +16,8 @@ export type App = Hono | Handler const processes = new Map }>() const restarting = new Set() -let nextPort = 4000 +const STARTING_PORT = 10000 +let nextPort = STARTING_PORT export async function initWebapps() { await startSubprocs() @@ -57,6 +58,8 @@ async function startApp(name: string): Promise { if (existing) return existing.port const port = String(nextPort++) + if (nextPort >= STARTING_PORT * 2) nextPort = STARTING_PORT + const proc = Bun.spawn({ cmd: [BUN_BIN, "run", "src/webapp/worker.ts", name], env: { ...process.env, PORT: String(port) }, @@ -84,7 +87,7 @@ function serveStatic(path: string): Response { export async function shutdownWebapps() { wwwWatcher?.close() - nextPort = 4000 + nextPort = STARTING_PORT for (const [name, { port, proc }] of processes) { webappLog(name, "Shutting down")