Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): prevent duplicate servers for one state directory #9652

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromt3code/prevent-duplicate-server-startsopened View on GitHub

Showing 23 changed files with 74 additions and 1 deletion (loading 20).

x
0 of 23 viewed, 23 left
47 additions and 0 deletionsapps/desktop/src/backend/DesktopBackendManager.test.tsModified
View file
@@ -22,6 +22,8 @@
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
​
+import { SERVER_EXIT_CODE_STATE_DIR_OWNED } from "@t3tools/contracts";
+​
import * as DesktopBackendManager from "./DesktopBackendManager.ts";
import * as DesktopObservability from "../app/DesktopObservability.ts";
import * as DesktopTelemetryPublisher from "../telemetry/DesktopTelemetryPublisher.ts";
@@ -124,6 +126,7 @@
readonly onPreflightFailed?: (
failure: DesktopBackendManager.PreflightFailure,
) => Effect.Effect<boolean>;
+ readonly onStateDirOwned?: Effect.Effect<void>;
readonly config?: DesktopBackendManager.DesktopBackendStartConfig;
readonly configResolve?: Effect.Effect<
DesktopBackendManager.DesktopBackendStartConfig,
@@ -185,6 +188,7 @@
...(input.onReady ? { onReady: () => input.onReady! } : {}),
...(input.onShutdown ? { onShutdown: () => input.onShutdown! } : {}),
...(input.onPreflightFailed ? { onPreflightFailed: input.onPreflightFailed } : {}),
+ ...(input.onStateDirOwned ? { onStateDirOwned: () => input.onStateDirOwned! } : {}),
});
​
return instance.pipe(Effect.provide(servicesLayer));
@@ -1204,6 +1208,49 @@