diff --git a/src/throttler-module-options.interface.ts b/src/throttler-module-options.interface.ts index 09858a4f..4d95ef31 100644 --- a/src/throttler-module-options.interface.ts +++ b/src/throttler-module-options.interface.ts @@ -125,7 +125,10 @@ export interface ThrottlerAsyncOptions extends Pick { /** * @publicApi */ -export type ThrottlerGetTrackerFunction = (req: Record) => Promise | string; +export type ThrottlerGetTrackerFunction = ( + req: Record, + context: ExecutionContext, +) => Promise | string; /** * @publicApi diff --git a/src/throttler.guard.ts b/src/throttler.guard.ts index d1d6a117..4646395c 100644 --- a/src/throttler.guard.ts +++ b/src/throttler.guard.ts @@ -165,7 +165,7 @@ export class ThrottlerGuard implements CanActivate { } } } - const tracker = await getTracker(req); + const tracker = await getTracker(req, context); const key = generateKey(context, tracker, throttler.name); const { totalHits, timeToExpire, isBlocked, timeToBlockExpire } = await this.storageService.increment(key, ttl, limit, blockDuration, throttler.name);