'order' result when using maxResults

This commit is contained in:
Cornelius Suermann 2024-12-20 10:52:54 +01:00
parent 8ab4f1d5ef
commit 6df5d285a8
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View file

@ -49,7 +49,8 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
const activeWorkflows = await this.find({
select: ['id'],
where: { active: true },
...(maxResults ? { take: maxResults } : {}),
// 'take' and 'order' are only needed when maxResults is provided:
...(maxResults ? { take: maxResults, order: { createdAt: 'ASC' } } : {}),
});
return activeWorkflows.map((workflow) => workflow.id);
}

View file

@ -38,6 +38,7 @@ export class LicenseMetricsService {
async collectPassthroughData() {
return {
// Get only the first 1000 active workflow IDs to avoid sending too much data to License Server
// Passthrough data is forwarded to Telemetry for further analysis, such as quota excesses
activeWorkflowIds: await this.workflowRepository.getActiveIds({ maxResults: 1000 }),
};
}