Skip to content

Commit cd9fb85

Browse files
committed
feat: add support for queue rate limit management
Implement updateQueueRateLimits and removeQueueRateLimits functions to interact with both MARQS and the internal RunQueue engine. These changes allow for dynamic adjustment of rate limiting configurations for specific queues.
1 parent 8ba8dec commit cd9fb85

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

apps/webapp/app/v3/runQueue.server.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,26 @@ export async function removeQueueConcurrencyLimits(
4242
engine.runQueue.removeQueueConcurrencyLimits(environment, queueName),
4343
]);
4444
}
45+
46+
/** Updates MARQS and the RunQueue rate limits for a queue */
47+
export async function updateQueueRateLimits(
48+
environment: AuthenticatedEnvironment,
49+
queueName: string,
50+
rateLimits: Array<{ limit: number; window: number }>
51+
) {
52+
await Promise.allSettled([
53+
marqs?.updateQueueRateLimits?.(environment, queueName, rateLimits),
54+
engine.runQueue.updateQueueRateLimits?.(environment, queueName, rateLimits),
55+
]);
56+
}
57+
58+
/** Removes MARQS and the RunQueue rate limits for a queue */
59+
export async function removeQueueRateLimits(
60+
environment: AuthenticatedEnvironment,
61+
queueName: string
62+
) {
63+
await Promise.allSettled([
64+
marqs?.removeQueueRateLimits?.(environment, queueName),
65+
engine.runQueue.removeQueueRateLimits?.(environment, queueName),
66+
]);
67+
}

0 commit comments

Comments
 (0)