qdone 2.0.28-alpha → 2.0.29-alpha

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.
@@ -183,7 +183,7 @@ function processMessages(queues, callback, options) {
183
183
  if (messages.length) {
184
184
  for (_i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
185
185
  message = messages_1[_i];
186
- jobExecutor.executeJob(message, callback, qname, qrl, function () { return queueManager.updateIcehouse(qrl, true); });
186
+ jobExecutor.executeJob(message, callback, qname, qrl);
187
187
  }
188
188
  queueManager.updateIcehouse(qrl, false);
189
189
  }
@@ -231,7 +231,7 @@ function processMessages(queues, callback, options) {
231
231
  targetJobs = Math.round(allowedJobs * overallFactor);
232
232
  jobsLeft = targetJobs;
233
233
  if (opt.verbose) {
234
- console.error({ jobCount: jobExecutor.activeJobCount(), freeMemory: freeMemory, totalMemory: totalMemory, freememThreshold: freememThreshold, remainingMemory: remainingMemory, memoryThreshold: memoryThreshold, maxReturnCount: maxReturnCount, allowedJobs: allowedJobs, maxLatency: maxLatency, latency: latency, latencyFactor: latencyFactor, freememFactor: freememFactor, oneMinuteLoad: oneMinuteLoad, loadPerCore: loadPerCore, loadFactor: loadFactor, overallFactor: overallFactor, targetJobs: targetJobs, activeQrls: activeQrls });
234
+ console.error({ maxConcurrentJobs: opt.maxConcurrentJobs, jobCount: jobExecutor.activeJobCount(), allowedJobs: allowedJobs, maxLatency: maxLatency, latencyFactor: latencyFactor, freememFactor: freememFactor, loadFactor: loadFactor, overallFactor: overallFactor, targetJobs: targetJobs, activeQrls: activeQrls });
235
235
  }
236
236
  for (_i = 0, _a = queueManager.getPairs(); _i < _a.length; _i++) {
237
237
  _b = _a[_i], qname = _b.qname, qrl = _b.qrl;
@@ -95,8 +95,11 @@ var QueueManager = /** @class */ (function () {
95
95
  var secondsElapsed = Math.round((now - lastCheck) / 1000);
96
96
  debug({ icehouseCheck: { qrl: qrl, lastCheck: lastCheck, secondsToWait: secondsToWait, secondsElapsed: secondsElapsed } });
97
97
  var letOut = secondsElapsed > secondsToWait;
98
- if (letOut && this.opt.verbose) {
99
- console.error(chalk_1.default.blue('Coming out of icehouse:'), qrl);
98
+ if (letOut) {
99
+ delete this.icehouse[qrl];
100
+ if (this.opt.verbose) {
101
+ console.error(chalk_1.default.blue('Coming out of icehouse:'), qrl);
102
+ }
100
103
  }
101
104
  return !letOut;
102
105
  }
@@ -125,7 +128,10 @@ var QueueManager = /** @class */ (function () {
125
128
  case 1:
126
129
  pairs = _a.sent();
127
130
  if (this.opt.verbose)
128
- console.error(chalk_1.default.blue('Resolving queues:'));
131
+ console.error(chalk_1.default.blue('Resolving queues:'), pairs.map(function (_a) {
132
+ var qname = _a.qname;
133
+ return qname;
134
+ }));
129
135
  if (this.shutdownRequested)
130
136
  return [2 /*return*/];
131
137
  now = new Date();
@@ -142,6 +148,13 @@ var QueueManager = /** @class */ (function () {
142
148
  var qname = _a.qname, qrl = _a.qrl;
143
149
  var isFifo = qname.endsWith('.fifo');
144
150
  return _this.opt.fifo ? isFifo : true;
151
+ })
152
+ // next dead
153
+ .filter(function (_a) {
154
+ var qname = _a.qname, qrl = _a.qrl;
155
+ var isFifo = qname.endsWith('.fifo');
156
+ var isDead = isFifo ? qname.endsWith('_dead.fifo') : qname.endsWith('_dead');
157
+ return !isDead;
145
158
  })
146
159
  // then icehouse
147
160
  .filter(function (_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.28-alpha",
3
+ "version": "2.0.29-alpha",
4
4
  "description": "Language agnostic job queue for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/consumer.js CHANGED
@@ -97,7 +97,7 @@ export async function processMessages (queues, callback, options) {
97
97
  if (!shutdownRequested) {
98
98
  if (messages.length) {
99
99
  for (const message of messages) {
100
- jobExecutor.executeJob(message, callback, qname, qrl, () => queueManager.updateIcehouse(qrl, true))
100
+ jobExecutor.executeJob(message, callback, qname, qrl)
101
101
  }
102
102
  queueManager.updateIcehouse(qrl, false)
103
103
  } else {
@@ -146,7 +146,7 @@ export async function processMessages (queues, callback, options) {
146
146
  let jobsLeft = targetJobs
147
147
 
148
148
  if (opt.verbose) {
149
- console.error({ jobCount: jobExecutor.activeJobCount(), freeMemory, totalMemory, freememThreshold, remainingMemory, memoryThreshold, maxReturnCount, allowedJobs, maxLatency, latency, latencyFactor, freememFactor, oneMinuteLoad, loadPerCore, loadFactor, overallFactor, targetJobs, activeQrls })
149
+ console.error({ maxConcurrentJobs: opt.maxConcurrentJobs, jobCount: jobExecutor.activeJobCount(), allowedJobs, maxLatency, latencyFactor, freememFactor, loadFactor, overallFactor, targetJobs, activeQrls })
150
150
  }
151
151
  for (const { qname, qrl } of queueManager.getPairs()) {
152
152
  // debug({ evaluating: { qname, qrl, jobsLeft, activeQrlsHasQrl: activeQrls.has(qrl) } })
@@ -57,8 +57,11 @@ export class QueueManager {
57
57
  const secondsElapsed = Math.round((now - lastCheck) / 1000)
58
58
  debug({ icehouseCheck: { qrl, lastCheck, secondsToWait, secondsElapsed } })
59
59
  const letOut = secondsElapsed > secondsToWait
60
- if (letOut && this.opt.verbose) {
61
- console.error(chalk.blue('Coming out of icehouse:'), qrl)
60
+ if (letOut) {
61
+ delete this.icehouse[qrl]
62
+ if (this.opt.verbose) {
63
+ console.error(chalk.blue('Coming out of icehouse:'), qrl)
64
+ }
62
65
  }
63
66
  return !letOut
64
67
  } else {
@@ -79,7 +82,7 @@ export class QueueManager {
79
82
  // Start processing
80
83
  const qnames = this.queues.map(queue => normalizeQueueName(queue, this.opt))
81
84
  const pairs = await getQnameUrlPairs(qnames, this.opt)
82
- if (this.opt.verbose) console.error(chalk.blue('Resolving queues:'))
85
+ if (this.opt.verbose) console.error(chalk.blue('Resolving queues:'), pairs.map(({ qname }) => qname))
83
86
 
84
87
  if (this.shutdownRequested) return
85
88
 
@@ -97,6 +100,12 @@ export class QueueManager {
97
100
  const isFifo = qname.endsWith('.fifo')
98
101
  return this.opt.fifo ? isFifo : true
99
102
  })
103
+ // next dead
104
+ .filter(({ qname, qrl }) => {
105
+ const isFifo = qname.endsWith('.fifo')
106
+ const isDead = isFifo ? qname.endsWith('_dead.fifo') : qname.endsWith('_dead')
107
+ return !isDead
108
+ })
100
109
  // then icehouse
101
110
  .filter(({ qname, qrl }) => !this.keepInIcehouse(qrl, now))
102
111