@yolo-croket-dev/core 1.7.25-slowquery.20 → 1.7.25-slowquery.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,7 +5,7 @@ import { GracefulShutdownService } from '../modules/graceful-shutdown/graceful-s
|
|
|
5
5
|
export declare class RPCInterceptor implements NestInterceptor {
|
|
6
6
|
private readonly reflector;
|
|
7
7
|
private readonly gracefulShutdownService;
|
|
8
|
-
protected readonly DEFAULT_TIMEOUT
|
|
8
|
+
protected readonly DEFAULT_TIMEOUT = 1000;
|
|
9
9
|
protected readonly DEFAULT_TIMEOUT_MESSAGE = "\uC694\uCCAD\uC774 \uD0C0\uC784\uC544\uC6C3\uB418\uC5C8\uC2B5\uB2C8\uB2E4.";
|
|
10
10
|
constructor(reflector: Reflector, gracefulShutdownService: GracefulShutdownService);
|
|
11
11
|
private maxLengthOverShorten;
|
|
@@ -54,7 +54,8 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
54
54
|
constructor(reflector, gracefulShutdownService) {
|
|
55
55
|
this.reflector = reflector;
|
|
56
56
|
this.gracefulShutdownService = gracefulShutdownService;
|
|
57
|
-
this.DEFAULT_TIMEOUT = 1000
|
|
57
|
+
this.DEFAULT_TIMEOUT = 1000; // 29분 타임아웃
|
|
58
|
+
// protected readonly DEFAULT_TIMEOUT = 1000 * 60 * 29; // 29분 타임아웃
|
|
58
59
|
this.DEFAULT_TIMEOUT_MESSAGE = '요청이 타임아웃되었습니다.';
|
|
59
60
|
}
|
|
60
61
|
maxLengthOverShorten(data) {
|
|
@@ -296,10 +297,23 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
296
297
|
.pipe((0, operators_1.timeout)({
|
|
297
298
|
each: this.DEFAULT_TIMEOUT,
|
|
298
299
|
with: () => {
|
|
300
|
+
console.log('RPCInterceptor timeout 발생');
|
|
299
301
|
msaLogger.error('RPCInterceptor timeout 발생', { traceId: execInterceptor.traceId }, { message: this.DEFAULT_TIMEOUT_MESSAGE });
|
|
300
302
|
abortController.abort();
|
|
301
|
-
|
|
303
|
+
return (0, rxjs_1.throwError)(() => new Error(this.DEFAULT_TIMEOUT_MESSAGE));
|
|
302
304
|
},
|
|
305
|
+
}), (0, operators_1.catchError)((error) => {
|
|
306
|
+
// eslint-disable-next-line no-console
|
|
307
|
+
console.log('AbortInterceptor: 에러 발생', {
|
|
308
|
+
error: error.message,
|
|
309
|
+
isAborted: abortController.signal.aborted,
|
|
310
|
+
});
|
|
311
|
+
// abort된 경우와 일반 에러를 구분
|
|
312
|
+
if (abortController.signal.aborted) {
|
|
313
|
+
return (0, rxjs_1.throwError)(() => new Error(`REQUEST_ABORTED: ${this.DEFAULT_TIMEOUT_MESSAGE}`));
|
|
314
|
+
}
|
|
315
|
+
// 다음 handler로 넘기고싶다.
|
|
316
|
+
return next.handle();
|
|
303
317
|
}), (0, operators_1.tap)({
|
|
304
318
|
next: async (val) => {
|
|
305
319
|
val.isError = false;
|
|
@@ -325,6 +339,7 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
325
339
|
// eslint-disable-next-line consistent-return
|
|
326
340
|
(0, operators_1.catchError)(async (err) => {
|
|
327
341
|
// timeout 에러 처리
|
|
342
|
+
console.log('RPCInterceptor catchError 발생', err);
|
|
328
343
|
const isTimeoutError = err instanceof Error && (err.name === 'TimeoutError' || err.message === this.DEFAULT_TIMEOUT_MESSAGE);
|
|
329
344
|
if (isTimeoutError) {
|
|
330
345
|
msaLogger.error('[타임 아웃] 메시지 재전송 처리', { traceId: execInterceptor.traceId }, {
|