qdone 2.0.41-alpha → 2.0.43-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 +1 -1
- package/commonjs/src/dedup.js +4 -0
- package/commonjs/src/defaults.js +4 -3
- package/commonjs/src/scheduler/jobExecutor.js +5 -1
- package/npm-shrinkwrap.json +16000 -0
- package/package.json +1 -1
- package/src/consumer.js +1 -1
- package/src/dedup.js +3 -0
- package/src/defaults.js +3 -3
- package/src/scheduler/jobExecutor.js +5 -2
package/commonjs/src/consumer.js
CHANGED
|
@@ -37,7 +37,7 @@ async function getMessages(qrl, opt, maxMessages) {
|
|
|
37
37
|
MaxNumberOfMessages: maxMessages,
|
|
38
38
|
MessageAttributeNames: ['All'],
|
|
39
39
|
QueueUrl: qrl,
|
|
40
|
-
VisibilityTimeout:
|
|
40
|
+
VisibilityTimeout: 120,
|
|
41
41
|
WaitTimeSeconds: opt.waitTime
|
|
42
42
|
};
|
|
43
43
|
const response = await (0, sqs_js_1.getSQSClient)().send(new client_sqs_1.ReceiveMessageCommand(params));
|
package/commonjs/src/dedup.js
CHANGED
|
@@ -65,6 +65,10 @@ function addDedupParamsToMessage(message, opt, messageOptions) {
|
|
|
65
65
|
if (!message.MessageDeduplicationId) {
|
|
66
66
|
message.MessageDeduplicationId = getDeduplicationId(message.MessageBody, opt);
|
|
67
67
|
}
|
|
68
|
+
else {
|
|
69
|
+
// Transform the incoming ID so that it fits SPS spec and is suitable for Redis
|
|
70
|
+
message.MessageDeduplicationId = getDeduplicationId(message.MessageDeduplicationId, opt);
|
|
71
|
+
}
|
|
68
72
|
// Track our own dedup id so we can look it up upon ReceiveMessage
|
|
69
73
|
if (opt.externalDedup) {
|
|
70
74
|
message.MessageAttributes = {
|
package/commonjs/src/defaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupVerbose = exports.setupAWS = exports.getOptionsWithDefaults = exports.validateMessageOptions = exports.defaults = void 0;
|
|
3
|
+
exports.setupVerbose = exports.setupAWS = exports.getOptionsWithDefaults = exports.validateMessageOptions = exports.validateInteger = exports.defaults = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Default options for qdone. Accepts a command line options object and
|
|
6
6
|
* returns nicely-named options.
|
|
@@ -56,6 +56,7 @@ function validateInteger(opt, name) {
|
|
|
56
56
|
throw new Error(`${name} needs to be an integer.`);
|
|
57
57
|
return parsed;
|
|
58
58
|
}
|
|
59
|
+
exports.validateInteger = validateInteger;
|
|
59
60
|
function validateMessageOptions(messageOptions) {
|
|
60
61
|
const validKeys = ['deduplicationId', 'groupId'];
|
|
61
62
|
if (typeof messageOptions === 'object' &&
|
|
@@ -112,7 +113,7 @@ function getOptionsWithDefaults(options) {
|
|
|
112
113
|
delay: options.delay || exports.defaults.delay,
|
|
113
114
|
sendRetries: options['send-retries'] || exports.defaults.sendRetries,
|
|
114
115
|
failDelay: options.failDelay || options['fail-delay'] || exports.defaults.failDelay,
|
|
115
|
-
dlq: dlq === false ? false :
|
|
116
|
+
dlq: dlq === false ? false : exports.defaults.dlq,
|
|
116
117
|
dlqSuffix: options.dlqSuffix || options['dlq-suffix'] || exports.defaults.dlqSuffix,
|
|
117
118
|
dlqAfter: options.dlqAfter || options['dlq-after'] || exports.defaults.dlqAfter,
|
|
118
119
|
tags: options.tags || undefined,
|
|
@@ -149,7 +150,7 @@ function getOptionsWithDefaults(options) {
|
|
|
149
150
|
// Validate dedup args
|
|
150
151
|
if (opt.externalDedup && !opt.cacheUri)
|
|
151
152
|
throw new Error('--external-dedup requires the --cache-uri argument');
|
|
152
|
-
if (opt.externalDedup && (
|
|
153
|
+
if (opt.externalDedup && (opt.dedupPeriod < 1))
|
|
153
154
|
throw new Error('--external-dedup of redis requires a --dedup-period > 1 second');
|
|
154
155
|
if (opt.dedupIdPerMessage && opt.deduplicationId)
|
|
155
156
|
throw new Error('Use either --deduplication-id or --dedup-id-per-message but not both');
|
|
@@ -164,6 +164,8 @@ class JobExecutor {
|
|
|
164
164
|
console.error('FAILED_MESSAGES', result.Failed);
|
|
165
165
|
for (const failed of result.Failed) {
|
|
166
166
|
console.error('FAILED_TO_EXTEND_JOB', this.jobsByMessageId[failed.Id]);
|
|
167
|
+
// ensure that we clean this one up so it doesn't generate api calls
|
|
168
|
+
this.jobsbymessageid[failed.id].status = 'failed';
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
171
|
if (result.Successful) {
|
|
@@ -205,6 +207,8 @@ class JobExecutor {
|
|
|
205
207
|
console.error('FAILED_MESSAGES', result.Failed);
|
|
206
208
|
for (const failed of result.Failed) {
|
|
207
209
|
console.error('FAILED_TO_DELETE_JOB', this.jobsByMessageId[failed.Id]);
|
|
210
|
+
// ensure that we clean this one up so it doesn't generate api calls
|
|
211
|
+
this.jobsbymessageid[failed.id].status = 'failed';
|
|
208
212
|
}
|
|
209
213
|
}
|
|
210
214
|
if (result.Successful) {
|
|
@@ -239,7 +243,7 @@ class JobExecutor {
|
|
|
239
243
|
}
|
|
240
244
|
addJob(message, callback, qname, qrl) {
|
|
241
245
|
// Create job entry and track it
|
|
242
|
-
const defaultVisibilityTimeout =
|
|
246
|
+
const defaultVisibilityTimeout = 120;
|
|
243
247
|
const job = {
|
|
244
248
|
status: 'waiting',
|
|
245
249
|
start: new Date(),
|