fixed a lot of lint and work on utils

This commit is contained in:
Boki 2025-06-19 21:07:37 -04:00
parent 4881a38c32
commit 42bc2966df
17 changed files with 183 additions and 93 deletions

View file

@ -93,7 +93,7 @@ export class QueueRateLimiter {
r.handler === handler &&
r.operation === operation
);
if (rule) return rule;
if (rule) {return rule;}
// 2. Check for handler-specific rule
rule = this.rules.find(r =>
@ -101,14 +101,14 @@ export class QueueRateLimiter {
r.queueName === queueName &&
r.handler === handler
);
if (rule) return rule;
if (rule) {return rule;}
// 3. Check for queue-specific rule
rule = this.rules.find(r =>
r.level === 'queue' &&
r.queueName === queueName
);
if (rule) return rule;
if (rule) {return rule;}
// 4. Check for global rule (least specific)
rule = this.rules.find(r => r.level === 'global');

View file

@ -210,7 +210,7 @@ describe('QueueRateLimiter', () => {
// Consume the limit
await rateLimiter.checkLimit('reset-test', 'operation');
let blocked = await rateLimiter.checkLimit('reset-test', 'operation');
const blocked = await rateLimiter.checkLimit('reset-test', 'operation');
expect(blocked.allowed).toBe(false);
// Reset limits
@ -248,7 +248,7 @@ describe('QueueRateLimiter', () => {
// Verify rule exists
await rateLimiter.checkLimit('remove-test', 'op');
let blocked = await rateLimiter.checkLimit('remove-test', 'op');
const blocked = await rateLimiter.checkLimit('remove-test', 'op');
expect(blocked.allowed).toBe(false);
// Remove rule