@yolo-croket-dev/core 1.7.25-slowquery.10 → 1.7.25-slowquery.12

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.
@@ -44,6 +44,7 @@ const rxjs_1 = require("rxjs");
44
44
  const operators_1 = require("rxjs/operators");
45
45
  const msa_logger_1 = __importStar(require("@yolo-croket-dev/msa-logger"));
46
46
  const amqplib_1 = __importDefault(require("amqplib"));
47
+ const abortable_promise_1 = require("@xuchaoqian/abortable-promise");
47
48
  // import Logger from '@yolo-croket-dev/logger';
48
49
  const functions_1 = require("../functions");
49
50
  const exceptions_1 = require("../exceptions");
@@ -179,7 +180,15 @@ let RPCInterceptor = class RPCInterceptor {
179
180
  const arg = args[0];
180
181
  const rmq = args[1];
181
182
  // 메시지에서 AbortController 가져오기
182
- const abortController = rmq.args[0].abortController;
183
+ // const abortController = (rmq as any).args[0].abortController;
184
+ const abortController = new AbortController();
185
+ const handler = context.getHandler();
186
+ console.log('args: ', args);
187
+ console.log('context: ', context);
188
+ const abortablePromise = new abortable_promise_1.AbortablePromise((...args) => handler(...args), abortController.signal);
189
+ context.handler = abortablePromise;
190
+ console.log('handler: ', handler);
191
+ console.log('context: ', context);
183
192
  // const messageId = (rmq as any).messageId;
184
193
  // if (!abortController) {
185
194
  // // AbortController가 없으면 기본 처리
@@ -349,20 +358,7 @@ let RPCInterceptor = class RPCInterceptor {
349
358
  // eslint-disable-next-line consistent-return
350
359
  return next
351
360
  .handle()
352
- .pipe((0, operators_1.switchMap)((val) => {
353
- console.log('switchMap called', val);
354
- if (abortController === null || abortController === void 0 ? void 0 : abortController.signal.aborted) {
355
- console.log('RPC Interceptor: Service execution aborted');
356
- return (0, rxjs_1.throwError)(() => new Error('Service execution aborted'));
357
- }
358
- // // AbortController를 컨텍스트에 주입
359
- // const request = context.switchToRpc().getData();
360
- // if (request && typeof request === 'object') {
361
- // (request as any).abortController = abortController;
362
- // (request as any).abortSignal = abortController?.signal;
363
- // }
364
- return (0, rxjs_1.of)(val);
365
- }),
361
+ .pipe(
366
362
  // timeout(1000 * 60 * 29), // 30분 타임아웃
367
363
  (0, operators_1.timeout)(1000 * 3), // 30분 타임아웃
368
364
  (0, operators_1.tap)({
@@ -395,7 +391,6 @@ let RPCInterceptor = class RPCInterceptor {
395
391
  if (isTimeoutError) {
396
392
  if (abortController) {
397
393
  abortController.abort();
398
- throw new Error('Message aborted due to timeout');
399
394
  }
400
395
  msaLogger.error('[타임 아웃] 메시지 재전송 처리', { traceId: execInterceptor.traceId }, {
401
396
  error: {
@@ -69,7 +69,12 @@ class GracefulServerRMQ extends microservices_1.ServerRMQ {
69
69
  reject(err);
70
70
  }
71
71
  }, abortController.signal);
72
- await abortablePromise;
72
+ abortablePromise.then((val) => {
73
+ console.log('handleMessage success', val);
74
+ }).catch((err) => {
75
+ console.log('handleMessage error', err);
76
+ throw err;
77
+ });
73
78
  }
74
79
  catch (error) {
75
80
  if (error.message.includes('Message aborted')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/core",
3
- "version": "1.7.25-slowquery.10",
3
+ "version": "1.7.25-slowquery.12",
4
4
  "author": "Yolo Co., Ltd.",
5
5
  "description": "Yolo commonization module",
6
6
  "main": "index.js",