Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): background service launcher uses 75% less memory #29284

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/29284/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 10 changed files with 58 additions and 34 deletions (loading 7).

x
0 of 10 viewed, 10 left
37 additions and 18 deletionsapps/server/scripts/cli.tsModified
View file
@@ -16,6 +16,7 @@
import * as HostProcess from "@t3tools/shared/HostProcess";
import { resolveSpawnCommand } from "@t3tools/shared/shell";
import {
+ ServerCliBootstrapTooLargeError,
ServerCliBuildAssetMissingError,
ServerCliCommandExitError,
ServerCliDevelopmentIconSourceMissingError,
@@ -127,30 +128,48 @@
(yield* HostProcess.Platform) === "linux" &&
(yield* HostProcess.Architecture) === "arm64";
const spawnCommand = yield* resolveSpawnCommand("vp", ["pack"]);
- yield* runCommand(
- ChildProcess.make(spawnCommand.command, spawnCommand.args, {
- cwd: serverDir,
- env: {
- ...process.env,
- T3CODE_PACK_EXE: linuxArm64 ? "bundle" : "1",
- T3CODE_PACK_EXE_TARGET: target ?? "",
- },
- stdout: config.verbose ? "inherit" : "ignore",
- stderr: "inherit",
- shell: spawnCommand.shell,
- }),
- );
+ const cliAssetDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-asset-" });
+ const pack = (packMode: "bundle" | "bootstrap" | "1") =>
+ runCommand(
+ ChildProcess.make(spawnCommand.command, spawnCommand.args, {