long-task-queue-reader 0.7.3-test.1 → 0.8.0-beta.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/bunfig.toml ADDED
@@ -0,0 +1,5 @@
1
+ [install]
2
+ registry = "https://registry.npmjs.org"
3
+
4
+ [install.scopes]
5
+ "@producteca" = { token = "$NPM_TOKEN", url = "https://registry.npmjs.org/" }
@@ -23,6 +23,9 @@
23
23
  "job-get-messages": function() {
24
24
  return logger.info("Obteniendo mensajes nuevas");
25
25
  },
26
+ "job-early-finish-messages": function() {
27
+ return logger.info("Finalizo la ejecucion de mensajes antes de tiempo");
28
+ },
26
29
  "job-finish-messages": function() {
27
30
  return logger.info("Finalizo la ejecucion de mensajes");
28
31
  },
@@ -49,10 +52,10 @@
49
52
  extend(LongTaskQueueReader, superClass);
50
53
 
51
54
  function LongTaskQueueReader(queue, arg, arg1, MessageExecutor, runner, fromPoison) {
52
- var action, eventName, level, logger, ref, ref1, ref2, ref3, ref4, ref5, transports;
55
+ var action, eventName, level, logger, ref, ref1, ref2, ref3, ref4, ref5, ref6, transports;
53
56
  this.queue = queue;
54
- this.waitingTime = (ref = arg.waitingTime) != null ? ref : 60, this.visibilityTimeout = (ref1 = arg.visibilityTimeout) != null ? ref1 : 60, this.maxRetries = (ref2 = arg.maxRetries) != null ? ref2 : 10;
55
- level = (ref3 = arg1.level) != null ? ref3 : "info", transports = (ref4 = arg1.transports) != null ? ref4 : [];
57
+ this.waitingTime = (ref = arg.waitingTime) != null ? ref : 60, this.visibilityTimeout = (ref1 = arg.visibilityTimeout) != null ? ref1 : 60, this.maxRetries = (ref2 = arg.maxRetries) != null ? ref2 : 10, this.earlyFinish = (ref3 = arg.earlyFinish) != null ? ref3 : false;
58
+ level = (ref4 = arg1.level) != null ? ref4 : "info", transports = (ref5 = arg1.transports) != null ? ref5 : [];
56
59
  this.MessageExecutor = MessageExecutor;
57
60
  this.runner = runner;
58
61
  this.fromPoison = fromPoison;
@@ -70,9 +73,9 @@
70
73
  level: level,
71
74
  transports: transports
72
75
  });
73
- ref5 = eventsToLog(logger);
74
- for (eventName in ref5) {
75
- action = ref5[eventName];
76
+ ref6 = eventsToLog(logger);
77
+ for (eventName in ref6) {
78
+ action = ref6[eventName];
76
79
  this.on("" + eventName, action);
77
80
  }
78
81
  }
@@ -104,6 +107,13 @@
104
107
  return function() {
105
108
  return _this.emit("job-finish-messages");
106
109
  };
110
+ })(this)).tap((function(_this) {
111
+ return function() {
112
+ if (_this.earlyFinish) {
113
+ _this.emit("job-early-finish-messages");
114
+ return process.exit(0);
115
+ }
116
+ };
107
117
  })(this))["catch"]((function(_this) {
108
118
  return function(err) {
109
119
  return _this.emit("job_error", {
@@ -30,7 +30,7 @@
30
30
 
31
31
  LongTaskQueueReaderBuilder.prototype.withQueue = function(opts) {
32
32
  var Queue;
33
- this.waitingTime = opts.waitingTime, this.timeToUpdateMessage = opts.timeToUpdateMessage;
33
+ this.waitingTime = opts.waitingTime, this.timeToUpdateMessage = opts.timeToUpdateMessage, this.earlyFinish = opts.earlyFinish;
34
34
  Queue = this._internalRequire("queue" + (this.poison ? ".poison" : ""));
35
35
  this.queue = new Queue(opts);
36
36
  this.dependencies.push(this.queue);
@@ -65,7 +65,8 @@
65
65
  return new QueueProcessor(_this.queue, {
66
66
  waitingTime: _this.waitingTime,
67
67
  timeToUpdateMessage: _this.timeToUpdateMessage,
68
- maxRetries: _this.maxRetries
68
+ maxRetries: _this.maxRetries,
69
+ earlyFinish: _this.earlyFinish
69
70
  }, {
70
71
  transports: _this.transports
71
72
  }, _this._internalRequire("messageExecutor"), _this.runner, _this.poison);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "long-task-queue-reader",
3
- "version": "0.7.3-test.1",
3
+ "version": "0.8.0-beta.1",
4
4
  "description": "long-task-queue-reader",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,7 +12,6 @@
12
12
  "url": "git+https://github.com/Parsimotion/long-task-queue-reader.git"
13
13
  },
14
14
  "dependencies": {
15
- "@producteca/releaseteca": "^1.2.0",
16
15
  "async": "~2.1.2",
17
16
  "aws-sdk": "^2.687.0",
18
17
  "azure-queue-node": "~1.1.0",
@@ -26,8 +25,7 @@
26
25
  "winston-cloudwatch": "^1.13.1"
27
26
  },
28
27
  "devDependencies": {
29
- "@commitlint/cli": "^8.3.5",
30
- "@commitlint/config-conventional": "^8.3.4",
28
+ "@producteca/linterteca": "^1.3.2",
31
29
  "coffee-script": "~1.11.0",
32
30
  "grunt": "~1.0.1",
33
31
  "grunt-bump": "~0.8.0",
@@ -43,7 +41,9 @@
43
41
  },
44
42
  "husky": {
45
43
  "hooks": {
46
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
44
+ "commit-msg": "npx linterteca-commitlint --edit $1",
45
+ "pre-commit": "npx lint-staged",
46
+ "pre-push": "npx linterteca"
47
47
  }
48
48
  },
49
49
  "author": "Parsimotion",
@@ -51,5 +51,15 @@
51
51
  "bugs": {
52
52
  "url": "https://github.com/Parsimotion/long-task-queue-reader/issues"
53
53
  },
54
- "homepage": "https://github.com/Parsimotion/long-task-queue-reader#readme"
54
+ "homepage": "https://github.com/Parsimotion/long-task-queue-reader#readme",
55
+ "lint-staged": {
56
+ "*.{js,jsx}": [
57
+ "linterteca-lint"
58
+ ]
59
+ },
60
+ "trustedDependencies": [
61
+ "aws-sdk",
62
+ "core-js",
63
+ "husky"
64
+ ]
55
65
  }