Skip to content

Commit 8ae4b16

Browse files
committed
Remove unnecessary disabled org check
1 parent a24b2a7 commit 8ae4b16

File tree

4 files changed

+0
-80
lines changed

4 files changed

+0
-80
lines changed

apps/webapp/app/v3/marqs/fairDequeuingStrategy.server.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export type FairDequeuingStrategyOptions = {
3636
defaultOrgConcurrency: number;
3737
defaultEnvConcurrency: number;
3838
parentQueueLimit: number;
39-
checkForDisabledOrgs: boolean;
4039
tracer: Tracer;
4140
seed?: string;
4241
/**
@@ -88,7 +87,6 @@ const defaultBiases: FairDequeuingStrategyBiases = {
8887
export class FairDequeuingStrategy implements MarQSFairDequeueStrategy {
8988
private _cache: UnkeyCache<{
9089
concurrencyLimit: number;
91-
disabledConcurrency: boolean;
9290
}>;
9391

9492
private _rng: seedrandom.PRNG;
@@ -107,11 +105,6 @@ export class FairDequeuingStrategy implements MarQSFairDequeueStrategy {
107105
fresh: 60_000, // The time in milliseconds that a value is considered fresh. Cache hits within this time will return the cached value.
108106
stale: 180_000, // The time in milliseconds that a value is considered stale. Cache hits within this time will return the cached value and trigger a background refresh.
109107
}),
110-
disabledConcurrency: new Namespace<boolean>(ctx, {
111-
stores: [memory],
112-
fresh: 30_000, // The time in milliseconds that a value is considered fresh. Cache hits within this time will return the cached value.
113-
stale: 180_000, // The time in milliseconds that a value is considered stale. Cache hits within this time will return the cached value and trigger a background refresh.
114-
}),
115108
});
116109

117110
this._rng = seedrandom(options.seed);
@@ -512,16 +505,6 @@ export class FairDequeuingStrategy implements MarQSFairDequeueStrategy {
512505
return await startSpan(this.options.tracer, "getOrgConcurrency", async (span) => {
513506
span.setAttribute("org_id", orgId);
514507

515-
if (this.options.checkForDisabledOrgs) {
516-
const isDisabled = await this.#getConcurrencyDisabled(orgId);
517-
518-
if (isDisabled) {
519-
span.setAttribute("disabled", true);
520-
521-
return { current: 0, limit: 0 };
522-
}
523-
}
524-
525508
const [currentValue, limitValue] = await Promise.all([
526509
this.#getOrgCurrentConcurrency(orgId),
527510
this.#getOrgConcurrencyLimit(orgId),
@@ -587,22 +570,6 @@ export class FairDequeuingStrategy implements MarQSFairDequeueStrategy {
587570
});
588571
}
589572

590-
async #getConcurrencyDisabled(orgId: string) {
591-
return await startSpan(this.options.tracer, "getConcurrencyDisabled", async (span) => {
592-
span.setAttribute("org_id", orgId);
593-
594-
const key = this.options.keys.disabledConcurrencyLimitKey(orgId);
595-
596-
const result = await this._cache.disabledConcurrency.swr(key, async () => {
597-
const value = await this.options.redis.exists(key);
598-
599-
return Boolean(value);
600-
});
601-
602-
return typeof result.val === "boolean" ? result.val : false;
603-
});
604-
}
605-
606573
async #getOrgConcurrencyLimit(orgId: string) {
607574
return await startSpan(this.options.tracer, "getOrgConcurrencyLimit", async (span) => {
608575
span.setAttribute("org_id", orgId);

apps/webapp/app/v3/marqs/index.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,6 @@ function getMarQSClient() {
16191619
keys: keysProducer,
16201620
defaultEnvConcurrency: env.DEFAULT_ENV_EXECUTION_CONCURRENCY_LIMIT,
16211621
defaultOrgConcurrency: env.DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT,
1622-
checkForDisabledOrgs: true,
16231622
biases: {
16241623
concurrencyLimitBias: env.MARQS_CONCURRENCY_LIMIT_BIAS,
16251624
availableCapacityBias: env.MARQS_AVAILABLE_CAPACITY_BIAS,
@@ -1635,7 +1634,6 @@ function getMarQSClient() {
16351634
keys: keysProducer,
16361635
defaultEnvConcurrency: env.DEFAULT_ENV_EXECUTION_CONCURRENCY_LIMIT,
16371636
defaultOrgConcurrency: env.DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT,
1638-
checkForDisabledOrgs: false,
16391637
biases: {
16401638
concurrencyLimitBias: 0.0,
16411639
availableCapacityBias: 0.0,

apps/webapp/app/v3/marqs/v2.server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ function getMarQSClient() {
8181
keys: new MarQSV2KeyProducer(KEY_PREFIX),
8282
defaultEnvConcurrency: env.V2_MARQS_DEFAULT_ENV_CONCURRENCY,
8383
defaultOrgConcurrency: env.DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT,
84-
checkForDisabledOrgs: true,
8584
}),
8685
envQueuePriorityStrategy: new NoopFairDequeuingStrategy(), // We don't use this in v2, since all queues go through the shared queue
8786
workers: 0,

apps/webapp/test/fairDequeuingStrategy.test.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ describe("FairDequeuingStrategy", () => {
2323
defaultOrgConcurrency: 10,
2424
defaultEnvConcurrency: 5,
2525
parentQueueLimit: 100,
26-
checkForDisabledOrgs: true,
2726
seed: "test-seed-1", // for deterministic shuffling
2827
});
2928

@@ -53,7 +52,6 @@ describe("FairDequeuingStrategy", () => {
5352
defaultOrgConcurrency: 2,
5453
defaultEnvConcurrency: 5,
5554
parentQueueLimit: 100,
56-
checkForDisabledOrgs: true,
5755
seed: "test-seed-2",
5856
});
5957

@@ -89,7 +87,6 @@ describe("FairDequeuingStrategy", () => {
8987
defaultOrgConcurrency: 10,
9088
defaultEnvConcurrency: 2,
9189
parentQueueLimit: 100,
92-
checkForDisabledOrgs: true,
9390
seed: "test-seed-3",
9491
});
9592

@@ -114,40 +111,6 @@ describe("FairDequeuingStrategy", () => {
114111
expect(result).toHaveLength(0);
115112
});
116113

117-
redisTest("should handle disabled orgs", async ({ redis }) => {
118-
const keyProducer = createKeyProducer("test");
119-
const strategy = new FairDequeuingStrategy({
120-
tracer,
121-
redis,
122-
keys: keyProducer,
123-
defaultOrgConcurrency: 10,
124-
defaultEnvConcurrency: 5,
125-
parentQueueLimit: 100,
126-
checkForDisabledOrgs: true,
127-
seed: "test-seed-4",
128-
});
129-
130-
await setupQueue({
131-
redis,
132-
keyProducer,
133-
parentQueue: "parent-queue",
134-
score: Date.now() - 1000,
135-
queueId: "queue-1",
136-
orgId: "org-1",
137-
envId: "env-1",
138-
});
139-
140-
await setupConcurrency({
141-
redis,
142-
keyProducer,
143-
org: { id: "org-1", currentConcurrency: 0, isDisabled: true },
144-
env: { id: "env-1", currentConcurrency: 0 },
145-
});
146-
147-
const result = await strategy.distributeFairQueuesFromParentQueue("parent-queue", "consumer-1");
148-
expect(result).toHaveLength(0);
149-
});
150-
151114
redisTest("should respect parentQueueLimit", async ({ redis }) => {
152115
const keyProducer = createKeyProducer("test");
153116
const strategy = new FairDequeuingStrategy({
@@ -157,7 +120,6 @@ describe("FairDequeuingStrategy", () => {
157120
defaultOrgConcurrency: 10,
158121
defaultEnvConcurrency: 5,
159122
parentQueueLimit: 2, // Only take 2 queues
160-
checkForDisabledOrgs: true,
161123
seed: "test-seed-6",
162124
});
163125

@@ -212,7 +174,6 @@ describe("FairDequeuingStrategy", () => {
212174
defaultOrgConcurrency: 10,
213175
defaultEnvConcurrency: 5,
214176
parentQueueLimit: 10,
215-
checkForDisabledOrgs: true,
216177
seed: "test-seed-reuse-1",
217178
reuseSnapshotCount: 1,
218179
});
@@ -302,7 +263,6 @@ describe("FairDequeuingStrategy", () => {
302263
defaultOrgConcurrency: 10,
303264
defaultEnvConcurrency: 5,
304265
parentQueueLimit: 100,
305-
checkForDisabledOrgs: true,
306266
seed: "test-seed-5",
307267
});
308268

@@ -460,7 +420,6 @@ describe("FairDequeuingStrategy", () => {
460420
defaultOrgConcurrency: 10,
461421
defaultEnvConcurrency: 5,
462422
parentQueueLimit: 100,
463-
checkForDisabledOrgs: true,
464423
seed: "fixed-seed",
465424
});
466425

@@ -620,7 +579,6 @@ describe("FairDequeuingStrategy", () => {
620579
defaultOrgConcurrency: 10,
621580
defaultEnvConcurrency: 5,
622581
parentQueueLimit: 100,
623-
checkForDisabledOrgs: true,
624582
seed: `test-seed-${i}`,
625583
biases: {
626584
concurrencyLimitBias: 0.8,
@@ -705,7 +663,6 @@ describe("FairDequeuingStrategy", () => {
705663
defaultOrgConcurrency: 10,
706664
defaultEnvConcurrency: 5,
707665
parentQueueLimit: 100,
708-
checkForDisabledOrgs: true,
709666
seed: "fixed-seed",
710667
biases: {
711668
concurrencyLimitBias: 0,
@@ -791,7 +748,6 @@ describe("FairDequeuingStrategy", () => {
791748
defaultOrgConcurrency: 10,
792749
defaultEnvConcurrency: 5,
793750
parentQueueLimit: 100,
794-
checkForDisabledOrgs: true,
795751
seed: "test-seed-max-orgs",
796752
maximumOrgCount: 2, // Only select top 2 orgs
797753
});

0 commit comments

Comments
 (0)