testing ratelimit

This commit is contained in:
Boki 2025-07-06 17:18:01 -04:00
parent 95b1381480
commit a616c92656
14 changed files with 411 additions and 3 deletions

View file

@ -101,6 +101,8 @@ export class HandlerScanner {
const schedules = HandlerClass.__schedules || [];
const isDisabled = HandlerClass.__disabled || false;
const disabledOperations = HandlerClass.__disabledOperations || [];
const handlerRateLimit = HandlerClass.__handlerRateLimit || null;
const operationRateLimits = HandlerClass.__rateLimits || {};
if (isDisabled) {
this.logger.debug('Skipping disabled handler', { handlerName });
@ -131,13 +133,14 @@ export class HandlerScanner {
return !isDisabled;
});
// Build metadata
// Build metadata with rate limit information
const metadata: HandlerMetadata = {
name: handlerName,
service: this.options.serviceName,
operations: enabledOperations.map((op: any) => ({
name: op.name,
method: op.method,
rateLimit: operationRateLimits[op.method] || null,
})),
schedules: enabledSchedules.map((schedule: any) => ({
operation: schedule.operation,
@ -148,6 +151,7 @@ export class HandlerScanner {
payload: schedule.payload,
batch: schedule.batch,
})),
rateLimit: handlerRateLimit,
};
// Build configuration with operation handlers