@autofleet/rabbit 2.1.4 → 2.1.5

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/dist/index.js CHANGED
@@ -59,7 +59,7 @@ class RabbitMq {
59
59
  const { properties: { timestamp, headers } } = msg;
60
60
  if (timestamp && (headers === null || headers === void 0 ? void 0 : headers.redisTimestampValidationKey) && this.redisClient) {
61
61
  const lastMessageTimestamp = yield this.redisClient.getAsync(headers.redisTimestampValidationKey);
62
- return !lastMessageTimestamp || !moment_1.default(parseInt(lastMessageTimestamp, 10) * SECONDS_TO_MILLISECONDS).isAfter(moment_1.default(timestamp * SECONDS_TO_MILLISECONDS));
62
+ return !lastMessageTimestamp || moment_1.default(parseInt(lastMessageTimestamp, 10) * SECONDS_TO_MILLISECONDS).isBefore(moment_1.default(timestamp * SECONDS_TO_MILLISECONDS));
63
63
  }
64
64
  return true;
65
65
  });
@@ -249,8 +249,7 @@ class RabbitMq {
249
249
  outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
250
250
  const shouldConsume = yield this.shouldConsumeMessageByTimestamp(parsedMessage);
251
251
  if (!shouldConsume) {
252
- this.ack(channel);
253
- return;
252
+ return this.ack(channel)(msg);
254
253
  }
255
254
  callback(parsedMessage, this.ack(channel, true), this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl }));
256
255
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -110,7 +110,7 @@ class RabbitMq implements IAfRabbitMq {
110
110
  const { properties: { timestamp, headers } } = msg;
111
111
  if (timestamp && headers?.redisTimestampValidationKey && this.redisClient) {
112
112
  const lastMessageTimestamp = await this.redisClient.getAsync(headers.redisTimestampValidationKey);
113
- return !lastMessageTimestamp || !moment(parseInt(lastMessageTimestamp, 10) * SECONDS_TO_MILLISECONDS).isAfter(moment(timestamp * SECONDS_TO_MILLISECONDS));
113
+ return !lastMessageTimestamp || moment(parseInt(lastMessageTimestamp, 10) * SECONDS_TO_MILLISECONDS).isBefore(moment(timestamp * SECONDS_TO_MILLISECONDS));
114
114
  }
115
115
  return true;
116
116
  }
@@ -283,8 +283,7 @@ class RabbitMq implements IAfRabbitMq {
283
283
  newTrace(traceTypes.RABBIT);
284
284
  const shouldConsume = await this.shouldConsumeMessageByTimestamp(parsedMessage);
285
285
  if (!shouldConsume) {
286
- this.ack(channel);
287
- return;
286
+ return this.ack(channel)(msg);
288
287
  }
289
288
  callback(parsedMessage, this.ack(channel, true), this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl }));
290
289
  },