Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): a slow host no longer shows settings as read-only #25526

Mergedyordis(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/25526/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 99 additions and 10 deletions.

x
0 of 2 viewed, 2 left
75 additions and 0 deletionspackages/client-runtime/src/state/environmentHttpAuth.test.tsModified
View file
@@ -13,9 +13,13 @@
type OrchestrationV2ThreadHistoryPage,
} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
+import * as Exit from "effect/Exit";
+import * as Fiber from "effect/Fiber";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
+import * as Queue from "effect/Queue";
import * as Schema from "effect/Schema";
+import * as TestClock from "effect/testing/TestClock";
import type { HttpClient } from "effect/http";
​
import * as RemoteEnvironmentAuthorization from "../authorization/service.ts";
@@ -170,6 +174,14 @@
​
+// Resolves "settled" instead of hanging when the load finishes without sending another request.
+function nextRequestOrSettled(requests: Queue.Queue<number>, load: Fiber.Fiber<unknown, unknown>) {
+ return Effect.raceFirst(
+ Queue.take(requests).pipe(Effect.as("sent" as const)),
+ Fiber.await(load).pipe(Effect.as("settled" as const)),
+ );
+}
+​
type HttpInput = ReturnType<typeof makeHarness>["input"];
const LOADERS: ReadonlyArray<{
readonly name: string;