qdone 2.0.22-alpha → 2.0.23-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.
package/commonjs/src/consumer.js
CHANGED
|
@@ -178,7 +178,7 @@ function processMessages(queues, callback, options) {
|
|
|
178
178
|
if (messages.length) {
|
|
179
179
|
for (_i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
|
|
180
180
|
message = messages_1[_i];
|
|
181
|
-
jobExecutor.executeJob(message, callback, qname, qrl);
|
|
181
|
+
jobExecutor.executeJob(message, callback, qname, qrl, function () { return queueManager.updateIcehouse(qrl, true); });
|
|
182
182
|
}
|
|
183
183
|
queueManager.updateIcehouse(qrl, false);
|
|
184
184
|
}
|
|
@@ -266,7 +266,7 @@ var JobExecutor = /** @class */ (function () {
|
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
268
|
};
|
|
269
|
-
JobExecutor.prototype.executeJob = function (message, callback, qname, qrl) {
|
|
269
|
+
JobExecutor.prototype.executeJob = function (message, callback, qname, qrl, failedCallback) {
|
|
270
270
|
return __awaiter(this, void 0, void 0, function () {
|
|
271
271
|
var payload, visibilityTimeout, job, oldJob, e, queue, result, err_1;
|
|
272
272
|
return __generator(this, function (_a) {
|
|
@@ -340,6 +340,9 @@ var JobExecutor = /** @class */ (function () {
|
|
|
340
340
|
return [3 /*break*/, 4];
|
|
341
341
|
case 3:
|
|
342
342
|
err_1 = _a.sent();
|
|
343
|
+
// Notify caller that we failed
|
|
344
|
+
if (failedCallback)
|
|
345
|
+
failedCallback(message, qname, qrl);
|
|
343
346
|
// Fail path for job execution
|
|
344
347
|
if (this.opt.verbose) {
|
|
345
348
|
console.error(chalk_1.default.red('FAILED'), message.Body);
|
package/package.json
CHANGED
package/src/consumer.js
CHANGED
|
@@ -91,7 +91,7 @@ export async function processMessages (queues, callback, options) {
|
|
|
91
91
|
const messages = await getMessages(qrl, opt, maxMessages)
|
|
92
92
|
if (messages.length) {
|
|
93
93
|
for (const message of messages) {
|
|
94
|
-
jobExecutor.executeJob(message, callback, qname, qrl)
|
|
94
|
+
jobExecutor.executeJob(message, callback, qname, qrl, () => queueManager.updateIcehouse(qrl, true))
|
|
95
95
|
}
|
|
96
96
|
queueManager.updateIcehouse(qrl, false)
|
|
97
97
|
} else {
|
|
@@ -193,7 +193,7 @@ export class JobExecutor {
|
|
|
193
193
|
}, nextCheckInMs)
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
async executeJob (message, callback, qname, qrl) {
|
|
196
|
+
async executeJob (message, callback, qname, qrl, failedCallback) {
|
|
197
197
|
// Create job entry and track it
|
|
198
198
|
const payload = this.opt.json ? JSON.parse(message.Body) : message.Body
|
|
199
199
|
const visibilityTimeout = 60
|
|
@@ -261,6 +261,8 @@ export class JobExecutor {
|
|
|
261
261
|
}
|
|
262
262
|
this.stats.jobsSucceeded++
|
|
263
263
|
} catch (err) {
|
|
264
|
+
// Notify caller that we failed
|
|
265
|
+
if (failedCallback) failedCallback(message, qname, qrl)
|
|
264
266
|
// Fail path for job execution
|
|
265
267
|
if (this.opt.verbose) {
|
|
266
268
|
console.error(chalk.red('FAILED'), message.Body)
|