@yolo-croket-dev/core 1.7.38-slowquery.0 → 1.7.38-slowquery.1
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.
|
@@ -4,6 +4,7 @@ interface RequestContext {
|
|
|
4
4
|
requestId: string;
|
|
5
5
|
createdAt: number;
|
|
6
6
|
parentContext?: RequestContext;
|
|
7
|
+
abortHandler?: () => void;
|
|
7
8
|
}
|
|
8
9
|
export declare class AbortContext {
|
|
9
10
|
private static asyncLocalStorage;
|
|
@@ -16,6 +17,7 @@ export declare class AbortContext {
|
|
|
16
17
|
requestId: string;
|
|
17
18
|
} | null;
|
|
18
19
|
static endContext(context?: RequestContext): void;
|
|
20
|
+
static updateContext(updatedData: Partial<RequestContext>): void;
|
|
19
21
|
/**
|
|
20
22
|
* 컨텍스트가 유효한지 확인
|
|
21
23
|
*/
|
|
@@ -37,7 +37,7 @@ class AbortContext {
|
|
|
37
37
|
static endContext(context) {
|
|
38
38
|
const selectContext = context || this.asyncLocalStorage.getStore();
|
|
39
39
|
if (selectContext) {
|
|
40
|
-
selectContext.abortSignal.removeEventListener('abort', () => { });
|
|
40
|
+
selectContext.abortSignal.removeEventListener('abort', selectContext.abortHandler || (() => { }));
|
|
41
41
|
this.asyncLocalStorage.disable();
|
|
42
42
|
// parent context가 있으면 전부 종료
|
|
43
43
|
if (selectContext.parentContext) {
|
|
@@ -45,6 +45,21 @@ class AbortContext {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
// 현재 컨텍스트를 업데이트하는 방법
|
|
49
|
+
static updateContext(updatedData) {
|
|
50
|
+
const currentContext = this.asyncLocalStorage.getStore();
|
|
51
|
+
if (!currentContext) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// 업데이트할 데이터만 갱신
|
|
55
|
+
const updatedContext = {
|
|
56
|
+
...currentContext,
|
|
57
|
+
...updatedData,
|
|
58
|
+
updatedAt: Date.now(), // `updatedAt` 값을 갱신
|
|
59
|
+
};
|
|
60
|
+
// 업데이트된 컨텍스트를 다시 저장
|
|
61
|
+
this.asyncLocalStorage.enterWith(updatedContext);
|
|
62
|
+
}
|
|
48
63
|
/**
|
|
49
64
|
* 컨텍스트가 유효한지 확인
|
|
50
65
|
*/
|