Skip to content

Commit

Permalink
feat(config)!: non-zero defaults for PR concurrent, hourly limits (#1…
Browse files Browse the repository at this point in the history
…9958)

Sets new defaults:
- `prConcurrentLimit`: 10 (instead of 0)
- `prHourlyLimit`: 2 (instead of 0)

Closes #19800

BREAKING CHANGE: Renovate now defaults to applying hourly and concurrent PR limits. To revert to unlimited, configure them back to `0`.
  • Loading branch information
rarkins committed Jan 31, 2023
1 parent 749ac31 commit 017e05f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
8 changes: 4 additions & 4 deletions lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1579,16 +1579,16 @@ const options: RenovateOptions[] = [
{
name: 'prHourlyLimit',
description:
'Rate limit PRs to maximum x created per hour. 0 (default) means no limit.',
'Rate limit PRs to maximum x created per hour. 0 means no limit.',
type: 'integer',
default: 0, // no limit
default: 2,
},
{
name: 'prConcurrentLimit',
description:
'Limit to a maximum of x concurrent branches/PRs. 0 (default) means no limit.',
'Limit to a maximum of x concurrent branches/PRs. 0 means no limit.',
type: 'integer',
default: 0, // no limit
default: 10,
},
{
name: 'branchConcurrentLimit',
Expand Down
2 changes: 0 additions & 2 deletions lib/config/presets/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,6 @@ describe('config/presets/index', () => {
':dependencyDashboard',
':semanticPrefixFixDepsChoreOthers',
':ignoreModulesAndTests',
':prHourlyLimit2',
':prConcurrentLimit10',
'group:monorepos',
'group:recommended',
'workarounds:all',
Expand Down
2 changes: 0 additions & 2 deletions lib/config/presets/internal/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export const presets: Record<string, Preset> = {
':dependencyDashboard',
':semanticPrefixFixDepsChoreOthers',
':ignoreModulesAndTests',
':prHourlyLimit2',
':prConcurrentLimit10',
'group:monorepos',
'group:recommended',
'workarounds:all',
Expand Down
1 change: 0 additions & 1 deletion lib/modules/platform/codecommit/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ module.exports = {
password: 'SECRET_ACCESS_KEY_GOES_HERE',
token: 'AWS_SESSION_TOKEN_GOES_HERE',
gitAuthor: 'your_email@domain',
prConcurrentLimit: 10,
packageRules: [
{
matchPackageNames: ['package_name', 'package_name2'],
Expand Down
18 changes: 10 additions & 8 deletions lib/workers/repository/process/limits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ describe('workers/repository/process/limits', () => {
});

it('returns prHourlyLimit if errored', async () => {
config.prHourlyLimit = 2;
config.prHourlyLimit = 5;
platform.getPrList.mockRejectedValue('Unknown error');
const res = await limits.getPrHourlyRemaining(config);
expect(res).toBe(2);
expect(res).toBe(5);
});

it('returns 99 if no hourly limit', async () => {
config.prHourlyLimit = 0;
const res = await limits.getPrHourlyRemaining(config);
expect(res).toBe(99);
});
Expand All @@ -75,23 +76,24 @@ describe('workers/repository/process/limits', () => {
});

it('returns 99 if no concurrent limit', async () => {
config.prConcurrentLimit = 0;
const res = await limits.getConcurrentPrsRemaining(config, []);
expect(res).toBe(99);
});
});

describe('getPrsRemaining()', () => {
it('returns hourly limit', async () => {
config.prHourlyLimit = 5;
config.prHourlyLimit = 1;
platform.getPrList.mockResolvedValueOnce([]);
const res = await limits.getPrsRemaining(config, []);
expect(res).toBe(5);
expect(res).toBe(1);
});

it('returns concurrent limit', async () => {
config.prConcurrentLimit = 5;
config.prConcurrentLimit = 1;
const res = await limits.getPrsRemaining(config, []);
expect(res).toBe(5);
expect(res).toBe(1);
});
});

Expand Down Expand Up @@ -122,9 +124,9 @@ describe('workers/repository/process/limits', () => {
expect(res).toBe(99);
});

it('returns 99 if no limits are set', () => {
it('returns 10 if no limits are set', () => {
const res = limits.getConcurrentBranchesRemaining(config, []);
expect(res).toBe(99);
expect(res).toBe(10);
});

it('returns prConcurrentLimit if errored', () => {
Expand Down

0 comments on commit 017e05f

Please sign in to comment.