@yolo-croket-dev/core 1.7.10 → 1.7.12-slowquery.0
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.
- package/interceptors/rpc.interceptor.js +10 -12
- package/package.json +1 -1
|
@@ -149,7 +149,6 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
149
149
|
const isAdmin = content.data.param ? content.data.param.isAdmin : false;
|
|
150
150
|
const reDeliveryCount = Number(message.properties.headers['x-delivery-count']) || 0; /** 몇번 재전달되었는지 */
|
|
151
151
|
const staticRetryCount = Number(options === null || options === void 0 ? void 0 : options.messageRetryCount) || 0; /** 최대 재시도 갯수 */
|
|
152
|
-
const isRedelivery = message.fields.redelivered;
|
|
153
152
|
const method = content.pattern;
|
|
154
153
|
const correlationId = message.properties.correlationId;
|
|
155
154
|
const execInterceptor = {
|
|
@@ -172,20 +171,17 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
172
171
|
properties: message.properties,
|
|
173
172
|
fields: message.fields,
|
|
174
173
|
time: Date.now(),
|
|
175
|
-
isRedelivery,
|
|
176
174
|
reDeliveryCount,
|
|
177
175
|
staticRetryCount,
|
|
178
176
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
})), { correlationId: message.properties.correlationId });
|
|
188
|
-
}
|
|
177
|
+
channel.sendToQueue(message.properties.replyTo, Buffer.from(JSON.stringify({
|
|
178
|
+
isError: true,
|
|
179
|
+
message: 'RETRY_COUNT_ZERO_OR_NO_RETRY',
|
|
180
|
+
status: 500,
|
|
181
|
+
duration: Date.now() - now,
|
|
182
|
+
arg,
|
|
183
|
+
timestamp: new Date(),
|
|
184
|
+
})), { correlationId: message.properties.correlationId });
|
|
189
185
|
channel.nack(message, false, false); /** 아마도 기본 30분 타임아웃이 지나고 새로 들어오면 발생할 예정, DLQ로 이동 */
|
|
190
186
|
message.properties.replyTo = undefined; /** replyTo가 존재하면 sendToQueue가 호출되므로, 삭제해주기 */
|
|
191
187
|
return new rxjs_1.Observable();
|
|
@@ -222,6 +218,7 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
222
218
|
&& err.isRetry !== false) {
|
|
223
219
|
/** 재시도 로직이 필요한 경우, 0보다 커야 정의된것. 기본값이 0, isRetry값이 false로 정의된 에러가 아니라면 전부 재시도 */
|
|
224
220
|
if (reDeliveryCount <= (staticRetryCount - 1)) { /** 재시도 횟수가 있고, 재시도 횟수보다 적을 경우, 0부터 카운팅 되므로 -1 */
|
|
221
|
+
message.properties.headers['x-requeue-reason'] = 'RETRY';
|
|
225
222
|
channel.nack(message, false, true);
|
|
226
223
|
message.properties.replyTo = undefined; /** replyTo가 존재하면 sendToQueue가 호출되므로, 삭제해주기 */
|
|
227
224
|
isAck = true;
|
|
@@ -229,6 +226,7 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
229
226
|
else {
|
|
230
227
|
const dlqMessage = JSON.stringify(abstractAmqpHandlerData);
|
|
231
228
|
channel.sendToQueue(message.properties.replyTo, Buffer.from(dlqMessage), { correlationId: message.properties.correlationId });
|
|
229
|
+
message.properties.headers['x-requeue-reason'] = 'DLQ-FORWARD';
|
|
232
230
|
channel.nack(message, false, false); /** 최대 진행 횟수가 넘어간다면 DLQ로 전달 */
|
|
233
231
|
}
|
|
234
232
|
isAck = true;
|