@yolo-croket-dev/core 1.7.44-slowquery.7 → 1.7.44-slowquery.8
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.
|
@@ -8,7 +8,6 @@ interface RequestContext {
|
|
|
8
8
|
export declare class AbortContext {
|
|
9
9
|
private static asyncLocalStorage;
|
|
10
10
|
private static contextCounter;
|
|
11
|
-
private static pendingAbortCallbacks;
|
|
12
11
|
static run<T>(abortSignal: AbortSignal, requestId: string, callback: (context: RequestContext) => T): T;
|
|
13
12
|
static getCurrentAbortSignal(): AbortSignal | null;
|
|
14
13
|
static getCurrentRequestId(): string | null;
|
|
@@ -16,16 +15,7 @@ export declare class AbortContext {
|
|
|
16
15
|
abortSignal: AbortSignal;
|
|
17
16
|
requestId: string;
|
|
18
17
|
} | null;
|
|
19
|
-
/**
|
|
20
|
-
* 컨텍스트 종료 전에 모든 abort 이벤트 리스너가 완료될 때까지 대기
|
|
21
|
-
*/
|
|
22
|
-
static waitForAbortHandlers(requestId: string): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* 이 컨텍스트의 모든 abort 이벤트 처리 완료 후 disable 호출
|
|
25
|
-
*/
|
|
26
|
-
static disableAfterAbortHandlers(requestId: string): Promise<void>;
|
|
27
18
|
static disable(): void;
|
|
28
|
-
static disableDeferred(): void;
|
|
29
19
|
static endContext(context?: RequestContext): void;
|
|
30
20
|
static updateContext(updatedData: Partial<RequestContext>): void;
|
|
31
21
|
/**
|
|
@@ -12,35 +12,6 @@ class AbortContext {
|
|
|
12
12
|
createdAt: Date.now(),
|
|
13
13
|
parentContext: currentContext || undefined,
|
|
14
14
|
};
|
|
15
|
-
// abort 이벤트가 발생할 때까지 대기하는 Promise 생성
|
|
16
|
-
const abortPromise = new Promise((resolve) => {
|
|
17
|
-
const checkAbortStatus = () => {
|
|
18
|
-
if (abortSignal.aborted) {
|
|
19
|
-
// 이벤트 루프를 두 번 통과시켜서 모든 abort 리스너가 완료되도록 보장
|
|
20
|
-
setTimeout(() => {
|
|
21
|
-
setTimeout(() => {
|
|
22
|
-
resolve();
|
|
23
|
-
}, 0);
|
|
24
|
-
}, 0);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
// 아직 abort가 발생하지 않았으면 즉시 resolve
|
|
28
|
-
resolve();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
abortSignal.addEventListener('abort', checkAbortStatus, { once: true });
|
|
32
|
-
// abort 이벤트가 이미 발생했는지 확인
|
|
33
|
-
if (abortSignal.aborted) {
|
|
34
|
-
checkAbortStatus();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
// abort가 발생하지 않은 상태라면 즉시 resolve
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
resolve();
|
|
40
|
-
}, 0);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
this.pendingAbortCallbacks.set(newContext.requestId, abortPromise);
|
|
44
15
|
return this.asyncLocalStorage.run(newContext, callback.bind(this, newContext));
|
|
45
16
|
}
|
|
46
17
|
static getCurrentAbortSignal() {
|
|
@@ -61,31 +32,9 @@ class AbortContext {
|
|
|
61
32
|
}
|
|
62
33
|
return null;
|
|
63
34
|
}
|
|
64
|
-
/**
|
|
65
|
-
* 컨텍스트 종료 전에 모든 abort 이벤트 리스너가 완료될 때까지 대기
|
|
66
|
-
*/
|
|
67
|
-
static async waitForAbortHandlers(requestId) {
|
|
68
|
-
const promise = this.pendingAbortCallbacks.get(requestId);
|
|
69
|
-
if (promise) {
|
|
70
|
-
await promise;
|
|
71
|
-
this.pendingAbortCallbacks.delete(requestId);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* 이 컨텍스트의 모든 abort 이벤트 처리 완료 후 disable 호출
|
|
76
|
-
*/
|
|
77
|
-
static async disableAfterAbortHandlers(requestId) {
|
|
78
|
-
await this.waitForAbortHandlers(requestId);
|
|
79
|
-
this.asyncLocalStorage.disable();
|
|
80
|
-
}
|
|
81
35
|
static disable() {
|
|
82
36
|
this.asyncLocalStorage.disable();
|
|
83
37
|
}
|
|
84
|
-
static disableDeferred() {
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
this.asyncLocalStorage.disable();
|
|
87
|
-
}, 0);
|
|
88
|
-
}
|
|
89
38
|
// 컨텍스트 종료
|
|
90
39
|
// eslint-disable-next-line consistent-return
|
|
91
40
|
static endContext(context) {
|
|
@@ -140,5 +89,3 @@ class AbortContext {
|
|
|
140
89
|
exports.AbortContext = AbortContext;
|
|
141
90
|
AbortContext.asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
142
91
|
AbortContext.contextCounter = 0;
|
|
143
|
-
// abort 이벤트 처리를 추적하기 위한 Map
|
|
144
|
-
AbortContext.pendingAbortCallbacks = new Map();
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
export declare class ContextPromisePatch {
|
|
2
2
|
private static isPatched;
|
|
3
3
|
private static originalPromise;
|
|
4
|
-
private static originalSetTimeout;
|
|
5
|
-
private static originalSetInterval;
|
|
6
|
-
private static originalClearTimeout;
|
|
7
|
-
private static originalClearInterval;
|
|
8
|
-
private static contextTimers;
|
|
9
|
-
private static timerContextMap;
|
|
10
|
-
private static contextPromises;
|
|
11
|
-
/**
|
|
12
|
-
* 특정 컨텍스트의 모든 타이머 정리
|
|
13
|
-
*/
|
|
14
|
-
static clearContextTimers(contextId: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* 특정 컨텍스트의 모든 Promise가 완료될 때까지 대기
|
|
17
|
-
*/
|
|
18
|
-
static waitForContextPromises(contextId: string): Promise<void>;
|
|
19
4
|
static patch(): void;
|
|
20
5
|
private static patchPromise;
|
|
21
|
-
private static patchTimeouts;
|
|
22
6
|
static unpatch(): void;
|
|
23
7
|
}
|
|
@@ -3,41 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContextPromisePatch = void 0;
|
|
4
4
|
const abort_context_1 = require("./abort-context");
|
|
5
5
|
class ContextPromisePatch {
|
|
6
|
-
/**
|
|
7
|
-
* 특정 컨텍스트의 모든 타이머 정리
|
|
8
|
-
*/
|
|
9
|
-
static clearContextTimers(contextId) {
|
|
10
|
-
const timers = this.contextTimers.get(contextId);
|
|
11
|
-
if (timers) {
|
|
12
|
-
for (const timerId of timers) {
|
|
13
|
-
this.originalClearTimeout(timerId);
|
|
14
|
-
this.originalClearInterval(timerId);
|
|
15
|
-
this.timerContextMap.delete(timerId);
|
|
16
|
-
}
|
|
17
|
-
this.contextTimers.delete(contextId);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 특정 컨텍스트의 모든 Promise가 완료될 때까지 대기
|
|
22
|
-
*/
|
|
23
|
-
static async waitForContextPromises(contextId) {
|
|
24
|
-
const promises = this.contextPromises.get(contextId);
|
|
25
|
-
if (promises && promises.size > 0) {
|
|
26
|
-
// 모든 Promise가 완료될 때까지 기다림
|
|
27
|
-
await Promise.allSettled(Array.from(promises));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
6
|
static patch() {
|
|
31
7
|
if (this.isPatched) {
|
|
32
8
|
return;
|
|
33
9
|
}
|
|
34
10
|
this.originalPromise = global.Promise;
|
|
35
|
-
this.originalSetTimeout = global.setTimeout;
|
|
36
|
-
this.originalSetInterval = global.setInterval;
|
|
37
|
-
this.originalClearTimeout = global.clearTimeout;
|
|
38
|
-
this.originalClearInterval = global.clearInterval;
|
|
39
11
|
this.patchPromise();
|
|
40
|
-
this.patchTimeouts();
|
|
41
12
|
this.isPatched = true;
|
|
42
13
|
}
|
|
43
14
|
static patchPromise() {
|
|
@@ -56,71 +27,7 @@ class ContextPromisePatch {
|
|
|
56
27
|
if (abortSignal.aborted) {
|
|
57
28
|
return Promise.reject(new Error(`REQUEST_ABORTED: Promise가 중단되었습니다 (${contextId})`));
|
|
58
29
|
}
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
-
let promise;
|
|
62
|
-
// executor 함수를 래핑하여 abort 체크 추가
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
-
const originalExecutor = args[0];
|
|
65
|
-
if (originalExecutor) {
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
const wrappedExecutor = (resolve, reject) => {
|
|
68
|
-
// abort 체크 함수
|
|
69
|
-
const checkAbort = () => {
|
|
70
|
-
if (abortSignal.aborted) {
|
|
71
|
-
reject(new Error(`REQUEST_ABORTED: Promise가 중단되었습니다 (${contextId})`));
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
// abort 이벤트 리스너 등록
|
|
75
|
-
abortSignal.addEventListener('abort', checkAbort, { once: false });
|
|
76
|
-
// 원본 executor 호출
|
|
77
|
-
try {
|
|
78
|
-
originalExecutor(
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
-
(value) => {
|
|
81
|
-
abortSignal.removeEventListener('abort', checkAbort);
|
|
82
|
-
resolve(value);
|
|
83
|
-
},
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
(reason) => {
|
|
86
|
-
abortSignal.removeEventListener('abort', checkAbort);
|
|
87
|
-
reject(reason);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
abortSignal.removeEventListener('abort', checkAbort);
|
|
92
|
-
reject(error);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
// 새로운 args 배열 생성
|
|
96
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
-
const newArgs = [
|
|
98
|
-
wrappedExecutor,
|
|
99
|
-
...args.slice(1),
|
|
100
|
-
];
|
|
101
|
-
promise = Reflect.construct(target, newArgs);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
promise = Reflect.construct(target, args);
|
|
105
|
-
}
|
|
106
|
-
// Promise 추적 추가
|
|
107
|
-
if (!ContextPromisePatch.contextPromises.has(contextId)) {
|
|
108
|
-
ContextPromisePatch.contextPromises.set(contextId, new Set());
|
|
109
|
-
}
|
|
110
|
-
ContextPromisePatch.contextPromises.get(contextId).add(promise);
|
|
111
|
-
// abort 이벤트 리스너 등록 (Promise가 abort되면 추적에서 제거하도록)
|
|
112
|
-
const abortListener = () => {
|
|
113
|
-
var _a;
|
|
114
|
-
// Promise가 abort되었을 때 추적에서 제거
|
|
115
|
-
(_a = ContextPromisePatch.contextPromises.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(promise);
|
|
116
|
-
};
|
|
117
|
-
abortSignal.addEventListener('abort', abortListener, { once: true });
|
|
118
|
-
// Promise 완료 시 추적에서 제거 및 리스너 해제
|
|
119
|
-
promise.finally(() => {
|
|
120
|
-
var _a;
|
|
121
|
-
(_a = ContextPromisePatch.contextPromises.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(promise);
|
|
122
|
-
abortSignal.removeEventListener('abort', abortListener);
|
|
123
|
-
});
|
|
30
|
+
const promise = Reflect.construct(target, args);
|
|
124
31
|
// Promise 체인에 자동으로 중단 확인 추가
|
|
125
32
|
return promise.then((result) => {
|
|
126
33
|
// 컨텍스트가 여전히 유효한지 확인
|
|
@@ -196,173 +103,13 @@ class ContextPromisePatch {
|
|
|
196
103
|
return originalReject.call(global.Promise, reason);
|
|
197
104
|
};
|
|
198
105
|
}
|
|
199
|
-
static patchTimeouts() {
|
|
200
|
-
// 각 컨텍스트별로 활성 타이머를 추적
|
|
201
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
|
-
const activeTimers = new Map();
|
|
203
|
-
// setTimeout 패치
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
|
-
global.setTimeout = (handler, timeout,
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
|
-
...args
|
|
208
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
209
|
-
) => {
|
|
210
|
-
const currentContext = abort_context_1.AbortContext.getCurrentContext();
|
|
211
|
-
if (!currentContext) {
|
|
212
|
-
// 원본 함수에 args 전달 (타입 안전하게)
|
|
213
|
-
if (args.length > 0) {
|
|
214
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
215
|
-
return this.originalSetTimeout(handler, timeout, ...args);
|
|
216
|
-
}
|
|
217
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
218
|
-
return this.originalSetTimeout(handler, timeout);
|
|
219
|
-
}
|
|
220
|
-
const abortSignal = currentContext.abortSignal;
|
|
221
|
-
const contextId = currentContext.requestId;
|
|
222
|
-
if (abortSignal.aborted) {
|
|
223
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
224
|
-
throw new Error(`REQUEST_ABORTED: setTimeout이 중단되었습니다 (${contextId})`);
|
|
225
|
-
}
|
|
226
|
-
const originalHandler = typeof handler === 'function' ? handler : undefined;
|
|
227
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
228
|
-
const wrappedHandler = () => {
|
|
229
|
-
// 타이머 실행 시점에 abort 여부 확인
|
|
230
|
-
if (abortSignal.aborted) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (originalHandler) {
|
|
234
|
-
originalHandler();
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
238
|
-
const timeoutId = this.originalSetTimeout(wrappedHandler, timeout);
|
|
239
|
-
activeTimers.set(timeoutId, {
|
|
240
|
-
contextId,
|
|
241
|
-
abortSignal,
|
|
242
|
-
});
|
|
243
|
-
// 타이머 추적
|
|
244
|
-
if (!this.contextTimers.has(contextId)) {
|
|
245
|
-
this.contextTimers.set(contextId, new Set());
|
|
246
|
-
}
|
|
247
|
-
this.contextTimers.get(contextId).add(timeoutId);
|
|
248
|
-
this.timerContextMap.set(timeoutId, contextId);
|
|
249
|
-
// 클로저로 필요한 정보를 캡처 (컨텍스트가 disable되어도 동작)
|
|
250
|
-
const capturedContextId = contextId;
|
|
251
|
-
const capturedActiveTimers = activeTimers;
|
|
252
|
-
const onAbort = () => {
|
|
253
|
-
var _a;
|
|
254
|
-
this.originalClearTimeout(timeoutId);
|
|
255
|
-
capturedActiveTimers.delete(timeoutId);
|
|
256
|
-
(_a = this.contextTimers.get(capturedContextId)) === null || _a === void 0 ? void 0 : _a.delete(timeoutId);
|
|
257
|
-
this.timerContextMap.delete(timeoutId);
|
|
258
|
-
};
|
|
259
|
-
abortSignal.addEventListener('abort', onAbort, { once: true });
|
|
260
|
-
return timeoutId;
|
|
261
|
-
};
|
|
262
|
-
// setInterval 패치
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
264
|
-
global.setInterval = (handler, timeout,
|
|
265
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
266
|
-
...args
|
|
267
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
268
|
-
) => {
|
|
269
|
-
const currentContext = abort_context_1.AbortContext.getCurrentContext();
|
|
270
|
-
if (!currentContext) {
|
|
271
|
-
// 원본 함수에 args 전달 (타입 안전하게)
|
|
272
|
-
if (args.length > 0) {
|
|
273
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
274
|
-
return this.originalSetInterval(handler, timeout, ...args);
|
|
275
|
-
}
|
|
276
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
277
|
-
return this.originalSetInterval(handler, timeout);
|
|
278
|
-
}
|
|
279
|
-
const abortSignal = currentContext.abortSignal;
|
|
280
|
-
const contextId = currentContext.requestId;
|
|
281
|
-
if (abortSignal.aborted) {
|
|
282
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
283
|
-
throw new Error(`REQUEST_ABORTED: setInterval이 중단되었습니다 (${contextId})`);
|
|
284
|
-
}
|
|
285
|
-
const originalHandler = typeof handler === 'function' ? handler : undefined;
|
|
286
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
|
-
const wrappedHandler = () => {
|
|
288
|
-
// 타이머 실행 시점에 abort 여부 확인
|
|
289
|
-
if (abortSignal.aborted) {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
if (originalHandler) {
|
|
293
|
-
originalHandler();
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
|
-
const intervalId = this.originalSetInterval(wrappedHandler, timeout);
|
|
298
|
-
activeTimers.set(intervalId, {
|
|
299
|
-
contextId,
|
|
300
|
-
abortSignal,
|
|
301
|
-
});
|
|
302
|
-
// 타이머 추적
|
|
303
|
-
if (!this.contextTimers.has(contextId)) {
|
|
304
|
-
this.contextTimers.set(contextId, new Set());
|
|
305
|
-
}
|
|
306
|
-
this.contextTimers.get(contextId).add(intervalId);
|
|
307
|
-
this.timerContextMap.set(intervalId, contextId);
|
|
308
|
-
// 클로저로 필요한 정보를 캡처 (컨텍스트가 disable되어도 동작)
|
|
309
|
-
const capturedContextId = contextId;
|
|
310
|
-
const capturedActiveTimers = activeTimers;
|
|
311
|
-
const onAbort = () => {
|
|
312
|
-
var _a;
|
|
313
|
-
this.originalClearInterval(intervalId);
|
|
314
|
-
capturedActiveTimers.delete(intervalId);
|
|
315
|
-
(_a = this.contextTimers.get(capturedContextId)) === null || _a === void 0 ? void 0 : _a.delete(intervalId);
|
|
316
|
-
this.timerContextMap.delete(intervalId);
|
|
317
|
-
};
|
|
318
|
-
abortSignal.addEventListener('abort', onAbort, { once: true });
|
|
319
|
-
return intervalId;
|
|
320
|
-
};
|
|
321
|
-
// clearTimeout 패치
|
|
322
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
323
|
-
global.clearTimeout = (timerId) => {
|
|
324
|
-
var _a;
|
|
325
|
-
activeTimers.delete(timerId);
|
|
326
|
-
const contextId = this.timerContextMap.get(timerId);
|
|
327
|
-
if (contextId) {
|
|
328
|
-
(_a = this.contextTimers.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(timerId);
|
|
329
|
-
this.timerContextMap.delete(timerId);
|
|
330
|
-
}
|
|
331
|
-
this.originalClearTimeout(timerId);
|
|
332
|
-
};
|
|
333
|
-
// clearInterval 패치
|
|
334
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
|
-
global.clearInterval = (timerId) => {
|
|
336
|
-
var _a;
|
|
337
|
-
activeTimers.delete(timerId);
|
|
338
|
-
const contextId = this.timerContextMap.get(timerId);
|
|
339
|
-
if (contextId) {
|
|
340
|
-
(_a = this.contextTimers.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(timerId);
|
|
341
|
-
this.timerContextMap.delete(timerId);
|
|
342
|
-
}
|
|
343
|
-
this.originalClearInterval(timerId);
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
106
|
static unpatch() {
|
|
347
107
|
if (!this.isPatched) {
|
|
348
108
|
return;
|
|
349
109
|
}
|
|
350
110
|
global.Promise = this.originalPromise;
|
|
351
|
-
global.setTimeout = this.originalSetTimeout;
|
|
352
|
-
global.setInterval = this.originalSetInterval;
|
|
353
|
-
global.clearTimeout = this.originalClearTimeout;
|
|
354
|
-
global.clearInterval = this.originalClearInterval;
|
|
355
111
|
this.isPatched = false;
|
|
356
112
|
}
|
|
357
113
|
}
|
|
358
114
|
exports.ContextPromisePatch = ContextPromisePatch;
|
|
359
115
|
ContextPromisePatch.isPatched = false;
|
|
360
|
-
// 컨텍스트별 활성 타이머 추적 (contextId -> Set<timerId>)
|
|
361
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
362
|
-
ContextPromisePatch.contextTimers = new Map();
|
|
363
|
-
// timerId -> contextId 매핑
|
|
364
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
365
|
-
ContextPromisePatch.timerContextMap = new Map();
|
|
366
|
-
// 컨텍스트별 활성 Promise 추적
|
|
367
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
368
|
-
ContextPromisePatch.contextPromises = new Map();
|
|
@@ -57,7 +57,6 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
57
57
|
this.gracefulShutdownService = gracefulShutdownService;
|
|
58
58
|
this.DEFAULT_TIMEOUT = 1000 * 60 * 29; // 29분 타임아웃
|
|
59
59
|
this.DEFAULT_TIMEOUT_MESSAGE = '요청이 타임아웃되었습니다.';
|
|
60
|
-
context_promise_patch_1.ContextPromisePatch.patch();
|
|
61
60
|
}
|
|
62
61
|
maxLengthOverShorten(data) {
|
|
63
62
|
if (typeof data !== 'string') {
|
|
@@ -170,6 +169,7 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
170
169
|
correlationId,
|
|
171
170
|
isMessageAck: false,
|
|
172
171
|
};
|
|
172
|
+
context_promise_patch_1.ContextPromisePatch.patch();
|
|
173
173
|
let abortController = new AbortController();
|
|
174
174
|
/** consume 메시지 전부 cancel */
|
|
175
175
|
if (this.gracefulShutdownService.isApplicationExit) {
|
|
@@ -355,14 +355,12 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
357
|
error: localErrorProcessor,
|
|
358
|
-
}), (0, operators_1.finalize)(
|
|
358
|
+
}), (0, operators_1.finalize)(() => {
|
|
359
359
|
this.gracefulShutdownService.popActiveInterceptors(execInterceptor);
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
setTimeout(() => {
|
|
361
|
+
functions_1.AbortContext.disable();
|
|
362
|
+
}, 1000 * 10);
|
|
362
363
|
abortController = null;
|
|
363
|
-
// 모든 Promise가 완료될 때까지 기다림
|
|
364
|
-
await context_promise_patch_1.ContextPromisePatch.waitForContextPromises(execInterceptor.traceId);
|
|
365
|
-
functions_1.AbortContext.disable();
|
|
366
364
|
return rxjs_1.EMPTY;
|
|
367
365
|
})));
|
|
368
366
|
}
|