From 6df5d285a8a47f7e776ab9e4f89f90893d96216a Mon Sep 17 00:00:00 2001 From: Cornelius Suermann Date: Fri, 20 Dec 2024 10:52:54 +0100 Subject: [PATCH] 'order' result when using maxResults --- packages/cli/src/databases/repositories/workflow.repository.ts | 3 ++- packages/cli/src/metrics/license-metrics.service.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/databases/repositories/workflow.repository.ts b/packages/cli/src/databases/repositories/workflow.repository.ts index 7c5b76f379..393e4948c9 100644 --- a/packages/cli/src/databases/repositories/workflow.repository.ts +++ b/packages/cli/src/databases/repositories/workflow.repository.ts @@ -49,7 +49,8 @@ export class WorkflowRepository extends Repository { 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); } diff --git a/packages/cli/src/metrics/license-metrics.service.ts b/packages/cli/src/metrics/license-metrics.service.ts index b0e0c8f117..b8fea3b29f 100644 --- a/packages/cli/src/metrics/license-metrics.service.ts +++ b/packages/cli/src/metrics/license-metrics.service.ts @@ -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 }), }; }