Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep events during thread subscription startup #9521

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

Showing 2 changed files with 11 additions and 5 deletions.

x
0 of 2 viewed, 2 left
8 additions and 4 deletionsapps/server/src/server.test.tsModified
View file
@@ -7304,7 +7304,6 @@
projectionSnapshotQuery: {
getThreadDetailSnapshot: () =>
Effect.gen(function* () {
- yield* Effect.sleep("25 millis");
yield* PubSub.publish(liveEvents, messageEvent);
return Option.some({ snapshotSequence: 1, thread });
@@ -7317,14 +7316,19 @@
withWsRpcClient(wsUrl, (client) =>
client[ORCHESTRATION_WS_METHODS.subscribeThread]({
threadId: defaultThreadId,
- }).pipe(Stream.take(2), Stream.runCollect),
+ requestCompletionMarker: true,
+ }).pipe(
+ Stream.takeUntil((item) => item.kind === "synchronized"),
+ Stream.runCollect,
+ ),
- ).pipe(Effect.timeout("2 seconds"));
+ );
assert.equal(items[0]?.kind, "snapshot");
assert.equal(items[1]?.kind, "event");
assert.equal(items[1]?.kind === "event" ? items[1].event.sequence : null, 2);
- }).pipe(Effect.provide(NodeHttpServer.layerTest), TestClock.withLive),
+ assert.equal(items[2]?.kind, "synchronized");
+ }).pipe(Effect.provide(NodeHttpServer.layerTest)),