Skip to content

Commit 7c72cdf

Browse files
committed
fix(webapp): publish full realtime change records from the metadata and tags routes
A change record without tags makes the router wake every tag feed in the environment to hydrate-and-classify, so high-frequency metadata updates caused unnecessary database load; a record without a batchId skips batch feeds entirely. Both routes now publish the full membership keys, piggybacked on reads they already do.
1 parent 9f4c374 commit 7c72cdf

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

apps/webapp/app/routes/api.v1.runs.$runId.metadata.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,12 @@ const { action } = createActionApiRoute(
187187
if (pgResult) {
188188
// Reflect metadata.set() on a live feed before the next lifecycle event. Publish the
189189
// internal id (the router keys single-run feeds by it, not the friendly id from the URL).
190-
publishChangeRecord({ runId: pgResult.runId, envId: env.id, batchId: pgResult.batchId });
190+
publishChangeRecord({
191+
runId: pgResult.runId,
192+
envId: env.id,
193+
tags: pgResult.runTags,
194+
batchId: pgResult.batchId,
195+
});
191196
return json({ metadata: pgResult.metadata }, { status: 200 });
192197
}
193198

apps/webapp/app/routes/api.v1.runs.$runId.tags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
9797
runId: taskRun.id,
9898
envId: env.id,
9999
tags: existing.concat(newTags),
100+
batchId: taskRun.batchId,
100101
});
101102
return json({ message: `Successfully set ${newTags.length} new tags.` }, { status: 200 });
102103
},

apps/webapp/app/services/metadata/updateMetadata.server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ export class UpdateMetadataService {
309309
select: {
310310
id: true,
311311
batchId: true,
312+
runTags: true,
312313
completedAt: true,
313314
status: true,
314315
metadata: true,
@@ -356,9 +357,10 @@ export class UpdateMetadataService {
356357

357358
return {
358359
metadata: newMetadata,
359-
// Internal id + batchId, so callers can publish realtime records keyed how the router indexes feeds.
360+
// Internal id + membership keys, so callers can publish full realtime records the router routes by index.
360361
runId: taskRun.id,
361362
batchId: taskRun.batchId,
363+
runTags: taskRun.runTags,
362364
};
363365
}
364366

0 commit comments

Comments
 (0)