From 75909674ae6d15aff8f9274f04ef2015c8fa1ad0 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 2 Mar 2024 14:54:26 +0100 Subject: [PATCH] Remove unnecessary calculation --- apps/api/src/aop/logging.interceptor.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/apps/api/src/aop/logging.interceptor.ts b/apps/api/src/aop/logging.interceptor.ts index b98c3d31b..aad56576a 100644 --- a/apps/api/src/aop/logging.interceptor.ts +++ b/apps/api/src/aop/logging.interceptor.ts @@ -8,8 +8,6 @@ import { import { Observable } from 'rxjs'; import { tap } from 'rxjs/operators'; -const dict = {}; - @Injectable() export class LoggingInterceptor implements NestInterceptor { intercept(context: ExecutionContext, next: CallHandler): Observable { @@ -32,21 +30,12 @@ export function LogPerformance( descriptor: PropertyDescriptor ) { const originalMethod = descriptor.value; - if (Object.keys(dict).includes(propertyKey)) { - dict[propertyKey] += 1; - } else { - dict[propertyKey] = 1; - } - descriptor.value = function (...args: any[]) { const time = Date.now(); const result = originalMethod.apply(this, args); const now = Date.now(); if (now - time > 100) { Logger.debug(`${propertyKey} returned within: ${now - time} ms`); - } else if (dict[propertyKey] > 100) { - Logger.debug(`${propertyKey} was called the 100th time`); - dict[propertyKey] = 0; } return result; };