Skip to content

Commit 7cd0f37

Browse files
feat
1 parent f30cd76 commit 7cd0f37

File tree

8 files changed

+64
-2
lines changed

8 files changed

+64
-2
lines changed

docs/docs/configuration/config-file.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ The following are settings that can be provided in your config file to modify So
5252
| `enablePublicAccess` **(deprecated)** | boolean | false || Use the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable instead. |
5353
| `experiment_repoDrivenPermissionSyncIntervalMs` | number | 24 hours | 1 | Interval at which the repo permission syncer should run. |
5454
| `experiment_userDrivenPermissionSyncIntervalMs` | number | 24 hours | 1 | Interval at which the user permission syncer should run. |
55+
| `maxAccountPermissionSyncJobConcurrency` | number | 8 | 1 | Concurrent account permission sync jobs. |
56+
| `maxRepoPermissionSyncJobConcurrency` | number | 8 | 1 | Concurrent repo permission sync jobs. |
5557

5658
# Tokens
5759

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@
7979
"type": "number",
8080
"description": "The interval (in milliseconds) at which the user permission syncer should run. Defaults to 24 hours.",
8181
"minimum": 1
82+
},
83+
"maxAccountPermissionSyncJobConcurrency": {
84+
"type": "number",
85+
"description": "The number of account permission sync jobs to run concurrently. Defaults to 8.",
86+
"minimum": 1
87+
},
88+
"maxRepoPermissionSyncJobConcurrency": {
89+
"type": "number",
90+
"description": "The number of repo permission sync jobs to run concurrently. Defaults to 8.",
91+
"minimum": 1
8292
}
8393
},
8494
"additionalProperties": false
@@ -215,6 +225,16 @@
215225
"type": "number",
216226
"description": "The interval (in milliseconds) at which the user permission syncer should run. Defaults to 24 hours.",
217227
"minimum": 1
228+
},
229+
"maxAccountPermissionSyncJobConcurrency": {
230+
"type": "number",
231+
"description": "The number of account permission sync jobs to run concurrently. Defaults to 8.",
232+
"minimum": 1
233+
},
234+
"maxRepoPermissionSyncJobConcurrency": {
235+
"type": "number",
236+
"description": "The number of repo permission sync jobs to run concurrently. Defaults to 8.",
237+
"minimum": 1
218238
}
219239
},
220240
"additionalProperties": false

packages/backend/src/ee/accountPermissionSyncer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class AccountPermissionSyncer {
4242
});
4343
this.worker = new Worker<AccountPermissionSyncJob>(QUEUE_NAME, this.runJob.bind(this), {
4444
connection: redis,
45-
concurrency: 1,
45+
concurrency: this.settings.maxAccountPermissionSyncJobConcurrency,
4646
});
4747
this.worker.on('completed', this.onJobCompleted.bind(this));
4848
this.worker.on('failed', this.onJobFailed.bind(this));

packages/backend/src/ee/repoPermissionSyncer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class RepoPermissionSyncer {
3535
});
3636
this.worker = new Worker<RepoPermissionSyncJob>(QUEUE_NAME, this.runJob.bind(this), {
3737
connection: redis,
38-
concurrency: 1,
38+
concurrency: this.settings.maxRepoPermissionSyncJobConcurrency,
3939
});
4040
this.worker.on('completed', this.onJobCompleted.bind(this));
4141
this.worker.on('failed', this.onJobFailed.bind(this));

packages/schemas/src/v3/index.schema.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ const schema = {
7878
"type": "number",
7979
"description": "The interval (in milliseconds) at which the user permission syncer should run. Defaults to 24 hours.",
8080
"minimum": 1
81+
},
82+
"maxAccountPermissionSyncJobConcurrency": {
83+
"type": "number",
84+
"description": "The number of account permission sync jobs to run concurrently. Defaults to 8.",
85+
"minimum": 1
86+
},
87+
"maxRepoPermissionSyncJobConcurrency": {
88+
"type": "number",
89+
"description": "The number of repo permission sync jobs to run concurrently. Defaults to 8.",
90+
"minimum": 1
8191
}
8292
},
8393
"additionalProperties": false
@@ -214,6 +224,16 @@ const schema = {
214224
"type": "number",
215225
"description": "The interval (in milliseconds) at which the user permission syncer should run. Defaults to 24 hours.",
216226
"minimum": 1
227+
},
228+
"maxAccountPermissionSyncJobConcurrency": {
229+
"type": "number",
230+
"description": "The number of account permission sync jobs to run concurrently. Defaults to 8.",
231+
"minimum": 1
232+
},
233+
"maxRepoPermissionSyncJobConcurrency": {
234+
"type": "number",
235+
"description": "The number of repo permission sync jobs to run concurrently. Defaults to 8.",
236+
"minimum": 1
217237
}
218238
},
219239
"additionalProperties": false

packages/schemas/src/v3/index.type.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ export interface Settings {
129129
* The interval (in milliseconds) at which the user permission syncer should run. Defaults to 24 hours.
130130
*/
131131
experiment_userDrivenPermissionSyncIntervalMs?: number;
132+
/**
133+
* The number of account permission sync jobs to run concurrently. Defaults to 8.
134+
*/
135+
maxAccountPermissionSyncJobConcurrency?: number;
136+
/**
137+
* The number of repo permission sync jobs to run concurrently. Defaults to 8.
138+
*/
139+
maxRepoPermissionSyncJobConcurrency?: number;
132140
}
133141
/**
134142
* Search context

packages/shared/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ export const DEFAULT_CONFIG_SETTINGS: ConfigSettings = {
2929
enablePublicAccess: false, // deprected, use FORCE_ENABLE_ANONYMOUS_ACCESS instead
3030
experiment_repoDrivenPermissionSyncIntervalMs: 1000 * 60 * 60 * 24, // 24 hours
3131
experiment_userDrivenPermissionSyncIntervalMs: 1000 * 60 * 60 * 24, // 24 hours
32+
maxAccountPermissionSyncJobConcurrency: 8,
33+
maxRepoPermissionSyncJobConcurrency: 8,
3234
}

schemas/v3/index.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@
7777
"type": "number",
7878
"description": "The interval (in milliseconds) at which the user permission syncer should run. Defaults to 24 hours.",
7979
"minimum": 1
80+
},
81+
"maxAccountPermissionSyncJobConcurrency": {
82+
"type": "number",
83+
"description": "The number of account permission sync jobs to run concurrently. Defaults to 8.",
84+
"minimum": 1
85+
},
86+
"maxRepoPermissionSyncJobConcurrency": {
87+
"type": "number",
88+
"description": "The number of repo permission sync jobs to run concurrently. Defaults to 8.",
89+
"minimum": 1
8090
}
8191
},
8292
"additionalProperties": false

0 commit comments

Comments
 (0)