fix: Add accurate concurrent executions count to executions list (#19249)

This commit is contained in:
Irénée
2025-09-15 13:23:05 +01:00
committed by GitHub
parent 7ded694ce7
commit dc75be3a6f
11 changed files with 225 additions and 62 deletions

View File

@@ -59,20 +59,32 @@ export class ExecutionsController {
const noRange = !query.range.lastId || !query.range.firstId;
if (noStatus && noRange) {
const executions = await this.executionService.findLatestCurrentAndCompleted(query);
const [executions, concurrentExecutionsCount] = await Promise.all([
this.executionService.findLatestCurrentAndCompleted(query),
this.executionService.getConcurrentExecutionsCount(),
]);
await this.executionService.addScopes(
req.user,
executions.results as ExecutionSummaries.ExecutionSummaryWithScopes[],
);
return executions;
return {
...executions,
concurrentExecutionsCount,
};
}
const executions = await this.executionService.findRangeWithCount(query);
const [executions, concurrentExecutionsCount] = await Promise.all([
this.executionService.findRangeWithCount(query),
this.executionService.getConcurrentExecutionsCount(),
]);
await this.executionService.addScopes(
req.user,
executions.results as ExecutionSummaries.ExecutionSummaryWithScopes[],
);
return executions;
return {
...executions,
concurrentExecutionsCount,
};
}
@Get('/:id')