Skip to content

Commit 5f43e6b

Browse files
committed
Enhance snapshot processing by capping MAX_CONCURRENT_PROCESSING to valid range and logging updates
1 parent c81b063 commit 5f43e6b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib/snapshotQueue.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,13 @@ export default class Queue {
280280
const useRemoteDiscovery = this.ctx.env.USE_REMOTE_DISCOVERY || this.ctx.config.useRemoteDiscovery;
281281

282282
if (useRemoteDiscovery && !this.ctx.config.delayedUpload && !this.ctx.config.allowDuplicateSnapshotNames) {
283-
const maxConcurrentProcessing = this.ctx.env.MAX_CONCURRENT_PROCESSING === 0 ? this.MAX_CONCURRENT_PROCESSING : this.ctx.env.MAX_CONCURRENT_PROCESSING;
283+
let maxConcurrentProcessing = this.ctx.env.MAX_CONCURRENT_PROCESSING === 0 ? this.MAX_CONCURRENT_PROCESSING : this.ctx.env.MAX_CONCURRENT_PROCESSING;
284+
if (maxConcurrentProcessing > 15 || maxConcurrentProcessing < 1) {
285+
this.ctx.log.info(`Larger than 15 concurrent processing. Setting to 5.`);
286+
maxConcurrentProcessing = 5;
287+
}
288+
289+
this.ctx.log.info(`Max concurrent processing: ${maxConcurrentProcessing}`);
284290
const snapshotsToProcess: Array<Snapshot> = [];
285291
const maxSnapshots = Math.min(maxConcurrentProcessing - this.activeProcessingCount, this.snapshots.length);
286292

0 commit comments

Comments
 (0)