We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4ce6ea4 + 857598b commit 1e610d4Copy full SHA for 1e610d4
1 file changed
backend/src/interceptors/timeout.interceptor.ts
@@ -5,8 +5,17 @@ import { Messages } from '../exceptions/text/messages.js';
5
6
@Injectable()
7
export class TimeoutInterceptor implements NestInterceptor {
8
- intercept(_context: ExecutionContext, next: CallHandler): Observable<any> {
9
- const timeoutMs = process.env.NODE_ENV !== 'test' ? 15000 : 200000;
+ intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
+ const request = context.switchToHttp().getRequest();
10
+ const isAIEndpoint = request.url.includes('/ai/v2/request/');
11
+ const timeoutMs = isAIEndpoint
12
+ ? process.env.NODE_ENV !== 'test'
13
+ ? 300000
14
+ : 600000
15
+ : process.env.NODE_ENV !== 'test'
16
+ ? 15000
17
+ : 200000;
18
+
19
return next.handle().pipe(
20
timeout(timeoutMs),
21
catchError((err) => {
0 commit comments