@devries-cameron20 / t3code Mirror · read-only / commits / ea16fcb7d4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 07:00 UTC

perf(server): stop tracing project enrichment cache reads (#29640)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 2, 2026 at 14:27 UTC ea16fcb7d4d76d34d29390315e3ed7cb9fb3c6b2
1 file changed +52 -48
apps/server/src/project/ProjectEnrichmentService.ts
+52 -48
@@ -210,63 +210,67 @@ export const make = Effect.fn("ProjectEnrichmentService.make")(function* (
210 { concurrency: "unbounded", discard: true },
211 );
212
213 - const requestLane = Effect.fn("ProjectEnrichmentService.requestLane")(function* (
213 + // Every project read lands here; only an actual enqueue gets a span, the resolve workers trace the work.
214 + const requestLane = Effect.fnUntraced(function* (
215 lane: EnrichmentWorkLane,
216 workspaceRoot: string,
217 field: "repositoryIdentity" | "faviconPath",
218 ) {
219 if (!(yield* reservePending(lane, workspaceRoot))) return;
219 - if (!(yield* Queue.offer(lane.queue, workspaceRoot))) {
220 - yield* removePending(lane, workspaceRoot);
221 - yield* Effect.logWarning("Project metadata enrichment queue is full", {
222 - workspaceRoot,
223 - field,
224 - });
225 - }
220 + yield* Effect.gen(function* () {
221 + if (!(yield* Queue.offer(lane.queue, workspaceRoot))) {
222 + yield* removePending(lane, workspaceRoot);
223 + yield* Effect.logWarning("Project metadata enrichment queue is full", {
224 + workspaceRoot,
225 + field,
226 + });
227 + }
228 + }).pipe(Effect.withSpan("ProjectEnrichmentService.requestLane"));
229 });
230
228 - const peek: ProjectEnrichmentService["Service"]["peek"] = Effect.fn(
229 - "ProjectEnrichmentService.peek",
230 - )(function* (workspaceRoot) {
231 - const [repositoryIdentity, faviconPath] = yield* Effect.all(
232 - [
233 - Cache.getSuccess(repositoryIdentityCache, workspaceRoot),
234 - Cache.getSuccess(faviconCache, workspaceRoot),
235 - ] as const,
236 - { concurrency: "unbounded" },
237 - );
238 - return {
239 - repositoryIdentity: availableValue(repositoryIdentity),
240 - faviconPath: availableValue(faviconPath),
241 - repositoryIdentityResolved: isSuccessfullyResolved(repositoryIdentity),
242 - };
243 - });
231 + // peek/request/getAvailable run per project on every shell read, inside the caller's span; own spans were ~0ms noise.
232 + const peek: ProjectEnrichmentService["Service"]["peek"] = Effect.fnUntraced(
233 + function* (workspaceRoot) {
234 + const [repositoryIdentity, faviconPath] = yield* Effect.all(
235 + [
236 + Cache.getSuccess(repositoryIdentityCache, workspaceRoot),
237 + Cache.getSuccess(faviconCache, workspaceRoot),
238 + ] as const,
239 + { concurrency: "unbounded" },
240 + );
241 + return {
242 + repositoryIdentity: availableValue(repositoryIdentity),
243 + faviconPath: availableValue(faviconPath),
244 + repositoryIdentityResolved: isSuccessfullyResolved(repositoryIdentity),
245 + };
246 + },
247 + );
248
245 - const request: ProjectEnrichmentService["Service"]["request"] = Effect.fn(
246 - "ProjectEnrichmentService.request",
247 - )(function* (workspaceRoot) {
248 - const [hasRepositoryIdentity, hasFaviconPath] = yield* Effect.all(
249 - [Cache.has(repositoryIdentityCache, workspaceRoot), Cache.has(faviconCache, workspaceRoot)],
250 - { concurrency: "unbounded" },
251 - );
252 - yield* Effect.all(
253 - [
254 - hasRepositoryIdentity
255 - ? Effect.void
256 - : requestLane(repositoryIdentityLane, workspaceRoot, "repositoryIdentity"),
257 - hasFaviconPath ? Effect.void : requestLane(faviconLane, workspaceRoot, "faviconPath"),
258 - ],
259 - { concurrency: "unbounded", discard: true },
260 - );
261 - });
249 + const request: ProjectEnrichmentService["Service"]["request"] = Effect.fnUntraced(
250 + function* (workspaceRoot) {
251 + const [hasRepositoryIdentity, hasFaviconPath] = yield* Effect.all(
252 + [Cache.has(repositoryIdentityCache, workspaceRoot), Cache.has(faviconCache, workspaceRoot)],
253 + { concurrency: "unbounded" },
254 + );
255 + yield* Effect.all(
256 + [
257 + hasRepositoryIdentity
258 + ? Effect.void
259 + : requestLane(repositoryIdentityLane, workspaceRoot, "repositoryIdentity"),
260 + hasFaviconPath ? Effect.void : requestLane(faviconLane, workspaceRoot, "faviconPath"),
261 + ],
262 + { concurrency: "unbounded", discard: true },
263 + );
264 + },
265 + );
266
263 - const getAvailable: ProjectEnrichmentService["Service"]["getAvailable"] = Effect.fn(
264 - "ProjectEnrichmentService.getAvailable",
265 - )(function* (workspaceRoot) {
266 - const available = yield* peek(workspaceRoot);
267 - yield* request(workspaceRoot);
268 - return available;
269 - });
267 + const getAvailable: ProjectEnrichmentService["Service"]["getAvailable"] = Effect.fnUntraced(
268 + function* (workspaceRoot) {
269 + const available = yield* peek(workspaceRoot);
270 + yield* request(workspaceRoot);
271 + return available;
272 + },
273 + );
274
275 const readRepositoryIdentity: ProjectEnrichmentService["Service"]["readRepositoryIdentity"] =
276 Effect.fn("ProjectEnrichmentService.readRepositoryIdentity")(function* (workspaceRoot) {