Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: cut websocket throughput in half by pruning activity payloads #4622

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

Showing 4 changed files with 229 additions and 1 deletion (loading 2).

x
0 of 4 viewed, 4 left
227 additions and 0 deletionsapps/server/src/orchestration/ActivityPayloadProjection.tsAdded
View file
@@ -0,0 +1,227 @@
+import type {
+ OrchestrationEvent,
+ OrchestrationThreadActivity,
+ OrchestrationThreadDetailSnapshot,
+} from "@t3tools/contracts";
+​
+function asRecord(value: unknown): Record<string, unknown> | null {
+ return value !== null && typeof value === "object" && !Array.isArray(value)
+ ? (value as Record<string, unknown>)
+ : null;
+}
+​
+function asTrimmedString(value: unknown): string | null {
+ if (typeof value !== "string") {
+ return null;
+ }
+ const trimmed = value.trim();
+ return trimmed.length > 0 ? trimmed : null;
+}
+​
+function pushChangedFile(target: string[], seen: Set<string>, value: unknown): void {
+ const normalized = asTrimmedString(value);
+ if (!normalized || seen.has(normalized)) {
+ return;
+ }
+ seen.add(normalized);
+ target.push(normalized);
+}
+​
+function collectChangedFiles(