Skip to content

Commit 521d2f9

Browse files
committed
Added a warning if you use the same queue twice with different settings
1 parent f4be73a commit 521d2f9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/core/src/v3/resource-catalog/standardResourceCatalog.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,29 @@ export class StandardResourceCatalog implements ResourceCatalog {
2424
}
2525

2626
registerQueueMetadata(queue: QueueManifest): void {
27+
const existingQueue = this._queueMetadata.get(queue.name);
28+
29+
//if it exists already AND concurrencyLimit or releaseConcurrencyOnWaitpoint is different, log a warning
30+
if (existingQueue) {
31+
const isConcurrencyLimitDifferent = existingQueue.concurrencyLimit !== queue.concurrencyLimit;
32+
const isReleaseConcurrencyOnWaitpointDifferent =
33+
existingQueue.releaseConcurrencyOnWaitpoint !== queue.releaseConcurrencyOnWaitpoint;
34+
35+
if (isConcurrencyLimitDifferent || isReleaseConcurrencyOnWaitpointDifferent) {
36+
let message = `Queue "${queue.name}" is defined twice, with different settings.`;
37+
if (isConcurrencyLimitDifferent) {
38+
message += `\n - concurrencyLimit: ${existingQueue.concurrencyLimit} vs ${queue.concurrencyLimit}`;
39+
}
40+
if (isReleaseConcurrencyOnWaitpointDifferent) {
41+
message += `\n - releaseConcurrencyOnWaitpoint: ${existingQueue.releaseConcurrencyOnWaitpoint} vs ${queue.releaseConcurrencyOnWaitpoint}`;
42+
}
43+
44+
message += "\n Skipping the second definition.";
45+
console.warn(message);
46+
return;
47+
}
48+
}
49+
2750
this._queueMetadata.set(queue.name, queue);
2851
}
2952

0 commit comments

Comments
 (0)