Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): release preview hosts after unanswered requests #11381

Mergedyashranaway(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/11381/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 139 additions and 1 deletion.

x
0 of 2 viewed, 2 left
132 additions and 0 deletionsapps/server/src/mcp/PreviewAutomationBroker.test.tsModified
View file
@@ -15,10 +15,13 @@
type PreviewAutomationStreamEvent,
} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
+import * as Exit from "effect/Exit";
+import * as Cause from "effect/Cause";
import * as Deferred from "effect/Deferred";
import * as Fiber from "effect/Fiber";
import * as Result from "effect/Result";
import * as Stream from "effect/Stream";
+import * as TestClock from "effect/testing/TestClock";
​
import * as PreviewAutomationBroker from "./PreviewAutomationBroker.ts";
​
@@ -1105,3 +1108,132 @@
+​
+it.effect("evicts an unanswered host and lets later calls use a healthy runtime", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const broker = yield* makeBroker;
+ const connected = yield* Deferred.make<string>();
+ const received = yield* Deferred.make<RoutedRequest>();
+ const otherReceived = yield* Deferred.make<void>();
+ const otherCompleted = yield* Deferred.make<void>();
+ const oldTab = PreviewTabId.make("tab-on-frozen-host");
+ const events = yield* broker.connect(makeHost());