qdone 2.0.2-alpha → 2.0.4-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.2-alpha",
3
+ "version": "2.0.4-alpha",
4
4
  "description": "Language agnostic job queue for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -43,7 +43,7 @@
43
43
  "lint": "standard",
44
44
  "coverage": "nyc report --reporter=text-lcov | coveralls",
45
45
  "standard": "standard",
46
- "prep-for-publish": "pnpm run clean && pnpm run build && npm shrinkwrap --production && echo now commit shrinkwrap and use npm run publish-{next,latest}",
46
+ "prep-for-publish": "echo YOU MUST USE NPM TO PREP FOR PUBLISH && pnpm run clean && pnpm run build && npm shrinkwrap --production && echo now commit shrinkwrap and use npm run publish-{next,latest}",
47
47
  "publish-latest": "npm publish --tag latest",
48
48
  "publish-next": "npm publish --tag next"
49
49
  },
package/src/cli.js CHANGED
@@ -51,7 +51,8 @@ const enqueueOptionDefinitions = [
51
51
  { name: 'group-id-per-message', type: Boolean, description: 'Use a unique Group ID for every message, even messages in the same batch.' },
52
52
  { name: 'deduplication-id', type: String, description: 'A Message Deduplication ID to give SQS when sending a message. Use this option if you are managing retries outside of qdone, and make sure the ID is the same for each retry in the deduplication window. Defaults to a string unique to this invocation.' },
53
53
  { name: 'message-retention-period', type: Number, description: `Number of seconds to retain jobs (up to 14 days). [default: ${defaults.messageRetentionPeriod}]` },
54
- { name: 'delay', alias: 'd', type: Number, description: 'Delays delivery of each message by the given number of seconds (up to 900 seconds, or 15 minutes). Defaults to immediate delivery (no delay).' },
54
+ { name: 'delay', type: Number, description: 'Delays delivery of the enqueued message by the given number of seconds (up to 900 seconds, or 15 minutes). Defaults to immediate delivery (no delay).' },
55
+ { name: 'fail-delay', type: Number, description: 'Delays delivery of all messages on this queue by the given number of seconds (up to 900 seconds, or 15 minutes). Only takes effect if this queue is created during this enqueue operation. Defaults to immediate delivery (no delay).' },
55
56
  { name: 'dlq', type: Boolean, description: 'Send messages from the failed queue to a DLQ.' },
56
57
  { name: 'dql-suffix', type: String, description: `Suffix to append to each queue to generate DLQ name [default: ${defaults.dlqSuffix}]` },
57
58
  { name: 'dql-after', type: String, description: `Drives message to the DLQ after this many failures in the failed queue. [default: ${defaults.dlqAfter}]` },
package/src/defaults.js CHANGED
@@ -25,6 +25,7 @@ export const defaults = Object.freeze({
25
25
  deduplicationId: uuidv1(),
26
26
  messageRetentionPeriod: 1209600,
27
27
  delay: 0,
28
+ failDelay: 0,
28
29
  dlq: false,
29
30
  dlqSuffix: '_dead',
30
31
  dlqAfter: 3,
@@ -78,6 +79,7 @@ export function getOptionsWithDefaults (options) {
78
79
  deduplicationId: options.deduplicationId || options['deduplication-id'] || defaults.deduplicationId,
79
80
  messageRetentionPeriod: options.messageRetentionPeriod || options['message-retention-period'] || defaults.messageRetentionPeriod,
80
81
  delay: options.delay || defaults.delay,
82
+ failDelay: options.failDelay || options['fail-delay'] || defaults.failDelay,
81
83
  dlq: dlq || defaults.dlq,
82
84
  dlqSuffix: options.dlqSuffix || options['dlq-suffix'] || defaults.dlqSuffix,
83
85
  dlqAfter: options.dlqAfter || options['dlq-after'] || defaults.dlqAfter,
package/src/enqueue.js CHANGED
@@ -82,6 +82,7 @@ export async function getOrCreateFailQueue (queue, opt) {
82
82
  maxReceiveCount: opt.dlqAfter + ''
83
83
  })
84
84
  }
85
+ if (opt.failDelay) params.Attributes.DelaySeconds = opt.failDelay
85
86
  if (opt.tags) params.tags = opt.tags
86
87
  if (opt.fifo) params.Attributes.FifoQueue = 'true'
87
88
  const cmd = new CreateQueueCommand(params)