diff --git a/src/module/sqs/prepare-message.js b/src/module/sqs/prepare-message.js index 7b3701d9..77f47e47 100644 --- a/src/module/sqs/prepare-message.js +++ b/src/module/sqs/prepare-message.js @@ -58,7 +58,7 @@ export const prepareMessage = (msg, opts) => { enumerable: false }); } - if (opts.delaySeconds !== undefined) { + if (opts.delaySeconds !== undefined && !(DELAY_SECONDS in msg)) { Object.defineProperty(msg, DELAY_SECONDS, { value: opts.delaySeconds, writable: false, diff --git a/test/module/sqs/queue-processor.spec.js b/test/module/sqs/queue-processor.spec.js index e5cc8cb7..b9ae7c16 100644 --- a/test/module/sqs/queue-processor.spec.js +++ b/test/module/sqs/queue-processor.spec.js @@ -427,9 +427,9 @@ describe('Testing QueueProcessor', { it('Testing multi prepare message error', async ({ capture }) => { const msg = { name: 'step1' }; - aws.sqs.prepareMessage(msg, { delaySeconds: 10 }); - expect(() => aws.sqs.prepareMessage(msg, { delaySeconds: 20 })) - .to.throw('Cannot redefine property: Symbol(delay-seconds)'); + aws.sqs.prepareMessage(msg, { urgent: false }); + expect(() => aws.sqs.prepareMessage(msg, { urgent: true })) + .to.throw('Cannot redefine property: Symbol(urgent)'); }); it('Testing empty setting on message', async () => {