@yolo-croket-dev/core 1.7.44-slowquery.2 → 1.7.44-slowquery.4
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,6 +5,12 @@ export declare class ContextPromisePatch {
|
|
|
5
5
|
private static originalSetInterval;
|
|
6
6
|
private static originalClearTimeout;
|
|
7
7
|
private static originalClearInterval;
|
|
8
|
+
private static contextTimers;
|
|
9
|
+
private static timerContextMap;
|
|
10
|
+
/**
|
|
11
|
+
* 특정 컨텍스트의 모든 타이머 정리
|
|
12
|
+
*/
|
|
13
|
+
static clearContextTimers(contextId: string): void;
|
|
8
14
|
static patch(): void;
|
|
9
15
|
private static patchPromise;
|
|
10
16
|
private static patchTimeouts;
|
|
@@ -3,6 +3,20 @@ 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
|
+
}
|
|
6
20
|
static patch() {
|
|
7
21
|
if (this.isPatched) {
|
|
8
22
|
return;
|
|
@@ -152,9 +166,18 @@ class ContextPromisePatch {
|
|
|
152
166
|
contextId,
|
|
153
167
|
abortSignal,
|
|
154
168
|
});
|
|
169
|
+
// 타이머 추적
|
|
170
|
+
if (!this.contextTimers.has(contextId)) {
|
|
171
|
+
this.contextTimers.set(contextId, new Set());
|
|
172
|
+
}
|
|
173
|
+
this.contextTimers.get(contextId).add(timeoutId);
|
|
174
|
+
this.timerContextMap.set(timeoutId, contextId);
|
|
155
175
|
const onAbort = () => {
|
|
176
|
+
var _a;
|
|
156
177
|
this.originalClearTimeout(timeoutId);
|
|
157
178
|
activeTimers.delete(timeoutId);
|
|
179
|
+
(_a = this.contextTimers.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(timeoutId);
|
|
180
|
+
this.timerContextMap.delete(timeoutId);
|
|
158
181
|
};
|
|
159
182
|
abortSignal.addEventListener('abort', onAbort, { once: true });
|
|
160
183
|
return timeoutId;
|
|
@@ -199,9 +222,18 @@ class ContextPromisePatch {
|
|
|
199
222
|
contextId,
|
|
200
223
|
abortSignal,
|
|
201
224
|
});
|
|
225
|
+
// 타이머 추적
|
|
226
|
+
if (!this.contextTimers.has(contextId)) {
|
|
227
|
+
this.contextTimers.set(contextId, new Set());
|
|
228
|
+
}
|
|
229
|
+
this.contextTimers.get(contextId).add(intervalId);
|
|
230
|
+
this.timerContextMap.set(intervalId, contextId);
|
|
202
231
|
const onAbort = () => {
|
|
232
|
+
var _a;
|
|
203
233
|
this.originalClearInterval(intervalId);
|
|
204
234
|
activeTimers.delete(intervalId);
|
|
235
|
+
(_a = this.contextTimers.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(intervalId);
|
|
236
|
+
this.timerContextMap.delete(intervalId);
|
|
205
237
|
};
|
|
206
238
|
abortSignal.addEventListener('abort', onAbort, { once: true });
|
|
207
239
|
return intervalId;
|
|
@@ -209,13 +241,25 @@ class ContextPromisePatch {
|
|
|
209
241
|
// clearTimeout 패치
|
|
210
242
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
211
243
|
global.clearTimeout = (timerId) => {
|
|
244
|
+
var _a;
|
|
212
245
|
activeTimers.delete(timerId);
|
|
246
|
+
const contextId = this.timerContextMap.get(timerId);
|
|
247
|
+
if (contextId) {
|
|
248
|
+
(_a = this.contextTimers.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(timerId);
|
|
249
|
+
this.timerContextMap.delete(timerId);
|
|
250
|
+
}
|
|
213
251
|
this.originalClearTimeout(timerId);
|
|
214
252
|
};
|
|
215
253
|
// clearInterval 패치
|
|
216
254
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
217
255
|
global.clearInterval = (timerId) => {
|
|
256
|
+
var _a;
|
|
218
257
|
activeTimers.delete(timerId);
|
|
258
|
+
const contextId = this.timerContextMap.get(timerId);
|
|
259
|
+
if (contextId) {
|
|
260
|
+
(_a = this.contextTimers.get(contextId)) === null || _a === void 0 ? void 0 : _a.delete(timerId);
|
|
261
|
+
this.timerContextMap.delete(timerId);
|
|
262
|
+
}
|
|
219
263
|
this.originalClearInterval(timerId);
|
|
220
264
|
};
|
|
221
265
|
}
|
|
@@ -233,3 +277,9 @@ class ContextPromisePatch {
|
|
|
233
277
|
}
|
|
234
278
|
exports.ContextPromisePatch = ContextPromisePatch;
|
|
235
279
|
ContextPromisePatch.isPatched = false;
|
|
280
|
+
// 컨텍스트별 활성 타이머 추적 (contextId -> Set<timerId>)
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
282
|
+
ContextPromisePatch.contextTimers = new Map();
|
|
283
|
+
// timerId -> contextId 매핑
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
|
+
ContextPromisePatch.timerContextMap = new Map();
|
|
@@ -355,10 +355,10 @@ 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
|
+
// 활성 타이머를 모두 정리
|
|
361
|
+
context_promise_patch_1.ContextPromisePatch.clearContextTimers(execInterceptor.traceId);
|
|
362
362
|
functions_1.AbortContext.disable();
|
|
363
363
|
abortController = null;
|
|
364
364
|
return rxjs_1.EMPTY;
|