@autofleet/rabbit 2.2.0-beta-1 → 2.2.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.
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ const logger_1 = __importDefault(require("./logger"));
24
24
  const rabbitError_1 = __importDefault(require("./rabbitError"));
25
25
  const redis_1 = __importDefault(require("./redis"));
26
26
  const DEFAULT_DEAD_TTL_TWO_DAYS = 60000 * 60 * 48;
27
+ const DEFAULT_LOCK_TIMEOUT = 1000 * 5;
27
28
  const defaultOptions = {
28
29
  limit: 1,
29
30
  retries: 1,
@@ -31,7 +32,6 @@ const defaultOptions = {
31
32
  };
32
33
  const assertExchangeFanout = (c, exchangeName) => c.assertExchange(exchangeName, 'fanout');
33
34
  const connectionCreatedConst = 'connectionCreated';
34
- const DEFAULT_LOCK_TIMEOUT = 1000;
35
35
  class RabbitMq {
36
36
  constructor(options, redisConfig) {
37
37
  this.PUBLISH_TIMEOUT = Number(process.env.RABBITMQ_PUBLISH_TIMEOUT) || 60000;
@@ -218,7 +218,7 @@ class RabbitMq {
218
218
  if (!this.redisLock) {
219
219
  throw new Error('Usage of consumeWithLock requires RedisInstance');
220
220
  }
221
- const lockTimeout = options && options.lockTimeout ? options.lockTimeout : DEFAULT_LOCK_TIMEOUT;
221
+ const lockTimeout = (options === null || options === void 0 ? void 0 : options.lockTimeout) || DEFAULT_LOCK_TIMEOUT;
222
222
  logger_1.default.info(`Consuming with lock from queue ${queue} with lockTimeout: ${lockTimeout}ms`);
223
223
  return this.consumeFromRabbit(queue, (msg, ack, nack) => __awaiter(this, void 0, void 0, function* () {
224
224
  if (!msg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.2.0-beta-1",
3
+ "version": "2.2.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -53,6 +53,7 @@ export interface AfRabbitOptions {
53
53
  }
54
54
 
55
55
  const DEFAULT_DEAD_TTL_TWO_DAYS = 60000 * 60 * 48;
56
+ const DEFAULT_LOCK_TIMEOUT = 1000 * 5;
56
57
 
57
58
  const defaultOptions = {
58
59
  limit: 1,
@@ -64,8 +65,6 @@ const assertExchangeFanout = (c: any, exchangeName: string) => c.assertExchange(
64
65
 
65
66
  const connectionCreatedConst = 'connectionCreated';
66
67
 
67
- const DEFAULT_LOCK_TIMEOUT = 1000;
68
-
69
68
  class RabbitMq implements IAfRabbitMq {
70
69
  static parseMsg(msg: any) : any {
71
70
  let { content } = msg;
@@ -286,7 +285,7 @@ class RabbitMq implements IAfRabbitMq {
286
285
  if (!this.redisLock) {
287
286
  throw new Error('Usage of consumeWithLock requires RedisInstance');
288
287
  }
289
- const lockTimeout = options && options.lockTimeout ? options.lockTimeout : DEFAULT_LOCK_TIMEOUT;
288
+ const lockTimeout = options?.lockTimeout || DEFAULT_LOCK_TIMEOUT;
290
289
  logger.info(`Consuming with lock from queue ${queue} with lockTimeout: ${lockTimeout}ms`);
291
290
  return this.consumeFromRabbit(queue, async (msg, ack, nack) => {
292
291
  if (!msg) {
package/.env DELETED
File without changes
package/dump.rdb DELETED
Binary file