Files
Goa-gel-fullstack/backend/src/common/interceptors/timeout.interceptor.ts

17 lines
417 B
TypeScript
Raw Normal View History

import {
Injectable,
NestInterceptor,
ExecutionContext,
CallHandler,
RequestTimeoutException,
} from '@nestjs/common';
import { Observable } from 'rxjs';
import { timeout } from 'rxjs/operators';
@Injectable()
export class TimeoutInterceptor implements NestInterceptor {
intercept(_context: ExecutionContext, next: CallHandler): Observable<unknown> {
return next.handle().pipe(timeout(30000));
}
}