Skip to content

Commit f22014c

Browse files
committed
fix(webapp): enforce the realtime tag/batch result cap exactly
The id resolver returned the repository's has-more overfetch (size + 1), so the feed could emit one run past the configured cap. Trim to the limit.
1 parent 8500781 commit f22014c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apps/webapp/app/services/realtime/clickHouseRunListResolver.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ClickHouseRunListResolver implements RunListResolver {
2727
const clickhouse = await this.options.getClickhouse(filter.organizationId);
2828
const repository = new RunsRepository({ clickhouse, prisma: this.options.prisma });
2929

30-
return repository.listRunIds({
30+
const ids = await repository.listRunIds({
3131
organizationId: filter.organizationId,
3232
projectId: filter.projectId,
3333
environmentId: filter.environmentId,
@@ -36,5 +36,9 @@ export class ClickHouseRunListResolver implements RunListResolver {
3636
from: filter.createdAtAfter?.getTime(),
3737
page: { size: filter.limit },
3838
});
39+
40+
// listRunIds overfetches by one (size + 1) for has-more detection and doesn't
41+
// trim, so enforce the caller's cap here.
42+
return ids.slice(0, filter.limit);
3943
}
4044
}

0 commit comments

Comments
 (0)