From 0071de2923ff6785976e71c2617b1914f7a27d43 Mon Sep 17 00:00:00 2001 From: Rahul Gautam Singh Date: Wed, 20 Nov 2024 16:11:41 +0530 Subject: [PATCH] apply suggestions --- lib/config/types.ts | 2 +- lib/workers/global/limits.spec.ts | 14 +++++++------- lib/workers/global/limits.ts | 5 +++-- lib/workers/repository/process/limits.ts | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/config/types.ts b/lib/config/types.ts index 5466ddc1c6e1c3..053b5662676bd1 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -270,7 +270,7 @@ export interface RenovateConfig packageFile?: string; packageRules?: PackageRule[]; postUpdateOptions?: string[]; - branchConcurrentLimit?: number; + branchConcurrentLimit?: number | null; prConcurrentLimit?: number; prHourlyLimit?: number; forkModeDisallowMaintainerEdits?: boolean; diff --git a/lib/workers/global/limits.spec.ts b/lib/workers/global/limits.spec.ts index 8f91182246c58a..9e48e5b716a78c 100644 --- a/lib/workers/global/limits.spec.ts +++ b/lib/workers/global/limits.spec.ts @@ -87,7 +87,7 @@ describe('workers/global/limits', () => { const upgrades = partial([ { prHourlyLimit: 10, - branchConcurrentLimit: null as never, + branchConcurrentLimit: null, prConcurrentLimit: 12, }, ]); @@ -145,8 +145,8 @@ describe('workers/global/limits', () => { }, { prHourlyLimit: 5, - branchConcurrentLimit: null as never, - prConcurrentLimit: undefined as never, + branchConcurrentLimit: null, + prConcurrentLimit: undefined, }, { prHourlyLimit: 5, @@ -207,7 +207,7 @@ describe('workers/global/limits', () => { }, { prHourlyLimit: 0, - branchConcurrentLimit: null as never, + branchConcurrentLimit: null, prConcurrentLimit: 3, }, ]); @@ -235,7 +235,7 @@ describe('workers/global/limits', () => { }, { prHourlyLimit: 0, - branchConcurrentLimit: null as never, + branchConcurrentLimit: null, prConcurrentLimit: 3, }, ]); @@ -264,7 +264,7 @@ describe('workers/global/limits', () => { }, { prHourlyLimit: 2, - branchConcurrentLimit: null as never, + branchConcurrentLimit: null, prConcurrentLimit: 3, }, ]); @@ -293,7 +293,7 @@ describe('workers/global/limits', () => { }, { prHourlyLimit: 5, - branchConcurrentLimit: null as never, + branchConcurrentLimit: null, prConcurrentLimit: 3, }, ]); diff --git a/lib/workers/global/limits.ts b/lib/workers/global/limits.ts index ca9fcae06166d1..431d6b0b1633c4 100644 --- a/lib/workers/global/limits.ts +++ b/lib/workers/global/limits.ts @@ -109,12 +109,13 @@ export function calcLimit( `${limitName} of the upgrades present in this branch`, ); - let lowestLimit = Number.MAX_SAFE_INTEGER; if (hasMultipleLimits(upgrades, limitName)) { - logger.warn( + logger.once.debug( `Branch has multiple ${limitName} limits. The lowest among these will be selected.`, ); } + + let lowestLimit = Number.MAX_SAFE_INTEGER; for (const upgrade of upgrades) { let limit = upgrade[limitName]; diff --git a/lib/workers/repository/process/limits.ts b/lib/workers/repository/process/limits.ts index 4103414ee133db..fb320f221f7321 100644 --- a/lib/workers/repository/process/limits.ts +++ b/lib/workers/repository/process/limits.ts @@ -11,7 +11,7 @@ export async function getPrHourlyCount( ): Promise { try { const prList = await platform.getPrList(); - const currentHourStart = DateTime.local().startOf('hour'); + const currentHourStart = DateTime.local().setZone('utc').startOf('hour'); logger.debug( `Calculating PRs created so far in this hour currentHourStart=${String(currentHourStart)}`, );