qdone 2.0.42-alpha → 2.0.44-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.
@@ -37,7 +37,7 @@ async function getMessages(qrl, opt, maxMessages) {
37
37
  MaxNumberOfMessages: maxMessages,
38
38
  MessageAttributeNames: ['All'],
39
39
  QueueUrl: qrl,
40
- VisibilityTimeout: 60,
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));
@@ -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 : (dlq || exports.defaults.dlq),
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 && (!opt.dedupPeriod || opt.dedupPeriod < 1))
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 = 60;
246
+ const defaultVisibilityTimeout = 120;
243
247
  const job = {
244
248
  status: 'waiting',
245
249
  start: new Date(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.42-alpha",
3
+ "version": "2.0.44-alpha",
4
4
  "description": "A distributed scheduler for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/src/consumer.js CHANGED
@@ -36,7 +36,7 @@ export async function getMessages (qrl, opt, maxMessages) {
36
36
  MaxNumberOfMessages: maxMessages,
37
37
  MessageAttributeNames: ['All'],
38
38
  QueueUrl: qrl,
39
- VisibilityTimeout: 60,
39
+ VisibilityTimeout: 120,
40
40
  WaitTimeSeconds: opt.waitTime
41
41
  }
42
42
  const response = await getSQSClient().send(new ReceiveMessageCommand(params))
package/src/defaults.js CHANGED
@@ -53,7 +53,7 @@ export const defaults = Object.freeze({
53
53
  create: false
54
54
  })
55
55
 
56
- function validateInteger (opt, name) {
56
+ export function validateInteger (opt, name) {
57
57
  const parsed = parseInt(opt[name], 10)
58
58
  if (isNaN(parsed)) throw new Error(`${name} needs to be an integer.`)
59
59
  return parsed
@@ -117,7 +117,7 @@ export function getOptionsWithDefaults (options) {
117
117
  delay: options.delay || defaults.delay,
118
118
  sendRetries: options['send-retries'] || defaults.sendRetries,
119
119
  failDelay: options.failDelay || options['fail-delay'] || defaults.failDelay,
120
- dlq: dlq === false ? false : (dlq || defaults.dlq),
120
+ dlq: dlq === false ? false : defaults.dlq,
121
121
  dlqSuffix: options.dlqSuffix || options['dlq-suffix'] || defaults.dlqSuffix,
122
122
  dlqAfter: options.dlqAfter || options['dlq-after'] || defaults.dlqAfter,
123
123
  tags: options.tags || undefined,
@@ -159,7 +159,7 @@ export function getOptionsWithDefaults (options) {
159
159
 
160
160
  // Validate dedup args
161
161
  if (opt.externalDedup && !opt.cacheUri) throw new Error('--external-dedup requires the --cache-uri argument')
162
- if (opt.externalDedup && (!opt.dedupPeriod || opt.dedupPeriod < 1)) throw new Error('--external-dedup of redis requires a --dedup-period > 1 second')
162
+ if (opt.externalDedup && (opt.dedupPeriod < 1)) throw new Error('--external-dedup of redis requires a --dedup-period > 1 second')
163
163
  if (opt.dedupIdPerMessage && opt.deduplicationId) throw new Error('Use either --deduplication-id or --dedup-id-per-message but not both')
164
164
 
165
165
  return opt
@@ -168,6 +168,8 @@ export class JobExecutor {
168
168
  console.error('FAILED_MESSAGES', result.Failed)
169
169
  for (const failed of result.Failed) {
170
170
  console.error('FAILED_TO_EXTEND_JOB', this.jobsByMessageId[failed.Id])
171
+ // ensure that we clean this one up so it doesn't generate api calls
172
+ this.jobsbymessageid[failed.Id].status = 'failed'
171
173
  }
172
174
  }
173
175
  if (result.Successful) {
@@ -210,6 +212,8 @@ export class JobExecutor {
210
212
  console.error('FAILED_MESSAGES', result.Failed)
211
213
  for (const failed of result.Failed) {
212
214
  console.error('FAILED_TO_DELETE_JOB', this.jobsByMessageId[failed.Id])
215
+ // ensure that we clean this one up so it doesn't generate api calls
216
+ this.jobsbymessageid[failed.Id].status = 'failed'
213
217
  }
214
218
  }
215
219
  if (result.Successful) {
@@ -250,7 +254,7 @@ export class JobExecutor {
250
254
 
251
255
  addJob (message, callback, qname, qrl) {
252
256
  // Create job entry and track it
253
- const defaultVisibilityTimeout = 60
257
+ const defaultVisibilityTimeout = 120
254
258
  const job = {
255
259
  status: 'waiting',
256
260
  start: new Date(),