@yolo-croket-dev/core 1.4.53-slowquery.3 → 1.4.53-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.
|
@@ -153,6 +153,12 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
153
153
|
// traceId,
|
|
154
154
|
// method,
|
|
155
155
|
// };
|
|
156
|
+
/** consume 메시지 전부 cancel */
|
|
157
|
+
if (this.gracefulShutdownService.isApplicationExit) {
|
|
158
|
+
msaLogger.debug('RPCInterceptor isApplicationExit called', { traceId: 'IS_APPLICATION_EXIT' });
|
|
159
|
+
channel.cancel(message.fields.consumerTag);
|
|
160
|
+
return new rxjs_1.Observable();
|
|
161
|
+
}
|
|
156
162
|
if (!staticRetryCount && reDeliveryCount > 0) {
|
|
157
163
|
channel.sendToQueue(message.properties.replyTo, Buffer.from(JSON.stringify({
|
|
158
164
|
isError: true,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { OnApplicationShutdown, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
-
export declare class GracefulShutdownService implements OnApplicationShutdown, OnModuleDestroy {
|
|
1
|
+
import { OnApplicationShutdown, OnModuleDestroy, OnApplicationBootstrap } from '@nestjs/common';
|
|
2
|
+
export declare class GracefulShutdownService implements OnApplicationShutdown, OnModuleDestroy, OnApplicationBootstrap {
|
|
3
3
|
private activeInterceptors;
|
|
4
|
+
isApplicationExit: boolean;
|
|
5
|
+
onApplicationBootstrap(): void;
|
|
4
6
|
incActiveInterceptors(): void;
|
|
5
7
|
decActiveInterceptors(): void;
|
|
6
8
|
onApplicationShutdown(signal?: string): Promise<void>;
|
|
@@ -36,6 +36,11 @@ const msaLogger = new msa_logger_1.default(msa_logger_1.ServerTypeEnum.SERVICE);
|
|
|
36
36
|
let GracefulShutdownService = class GracefulShutdownService {
|
|
37
37
|
constructor() {
|
|
38
38
|
this.activeInterceptors = 0;
|
|
39
|
+
this.isApplicationExit = false;
|
|
40
|
+
}
|
|
41
|
+
onApplicationBootstrap() {
|
|
42
|
+
msaLogger.debug('GracefulShutdownService.onApplicationBootstrap', { traceId: 'ON_APPLICATION_BOOTSTRAP' });
|
|
43
|
+
this.activeInterceptors = 0;
|
|
39
44
|
}
|
|
40
45
|
incActiveInterceptors() {
|
|
41
46
|
this.activeInterceptors += 1;
|
|
@@ -46,7 +51,10 @@ let GracefulShutdownService = class GracefulShutdownService {
|
|
|
46
51
|
msaLogger.debug(`GracefulShutdownService.decActiveInterceptors: ${this.activeInterceptors}`, { traceId: 'DEC_ACTIVE_INTERCEPTORS' });
|
|
47
52
|
}
|
|
48
53
|
async onApplicationShutdown(signal) {
|
|
54
|
+
this.isApplicationExit = true;
|
|
49
55
|
msaLogger.debug(`GracefulShutdownService.onApplicationShutdown: ${signal}`, { traceId: 'ON_APPLICATION_SHUTDOWN' });
|
|
56
|
+
// eslint-disable-next-line max-len
|
|
57
|
+
msaLogger.debug(`GracefulShutdownService.onApplicationShutdown: activeInterceptors=${this.activeInterceptors}`, { traceId: 'ON_APPLICATION_SHUTDOWN' });
|
|
50
58
|
while (this.activeInterceptors > 0) {
|
|
51
59
|
// eslint-disable-next-line max-len
|
|
52
60
|
msaLogger.debug(`GracefulShutdownService.onApplicationShutdown: waiting for ${this.activeInterceptors} interceptors to finish`, { traceId: 'ON_APPLICATION_SHUTDOWN' });
|
|
@@ -56,7 +64,9 @@ let GracefulShutdownService = class GracefulShutdownService {
|
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
async onModuleDestroy() {
|
|
67
|
+
this.isApplicationExit = true;
|
|
59
68
|
msaLogger.debug('GracefulShutdownService.onModuleDestroy', { traceId: 'ON_MODULE_DESTROY' });
|
|
69
|
+
msaLogger.debug(`GracefulShutdownService.onModuleDestroy: activeInterceptors=${this.activeInterceptors}`, { traceId: 'ON_MODULE_DESTROY' });
|
|
60
70
|
while (this.activeInterceptors > 0) {
|
|
61
71
|
// eslint-disable-next-line max-len
|
|
62
72
|
msaLogger.debug(`GracefulShutdownService.onModuleDestroy: waiting for ${this.activeInterceptors} interceptors to finish`, { traceId: 'ON_MODULE_DESTROY' });
|