qdone 2.0.27-alpha → 2.0.28-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.27-alpha",
3
+ "version": "2.0.28-alpha",
4
4
  "description": "Language agnostic job queue for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -101,7 +101,7 @@ export class JobExecutor {
101
101
  const secondsUntilMax = Math.max(1, maxJobSeconds - jobRunTime)
102
102
  // const secondsUntilKill = Math.max(1, this.opt.killAfter - jobRunTime)
103
103
  job.visibilityTimeout = Math.min(doubled, secondsUntilMax) //, secondsUntilKill)
104
- job.extendAtSecond = Math.round(jobRunTime + job.visibilityTimeout) // this is what we use next time
104
+ job.extendAtSecond = Math.round(jobRunTime + job.visibilityTimeout / 2) // this is what we use next time
105
105
  debug({ doubled, secondsUntilMax, job })
106
106
  }
107
107
  }
@@ -119,7 +119,7 @@ export class JobExecutor {
119
119
  while (messageId++ < 10 && jobsToExtend.length) {
120
120
  const job = jobsToExtend.shift()
121
121
  const entry = {
122
- Id: '' + messageId,
122
+ Id: job.message.MessageId,
123
123
  ReceiptHandle: job.message.ReceiptHandle,
124
124
  VisibilityTimeout: job.visibilityTimeout
125
125
  }
@@ -133,6 +133,12 @@ export class JobExecutor {
133
133
  const result = await getSQSClient().send(new ChangeMessageVisibilityBatchCommand(input))
134
134
  debug('ChangeMessageVisibilityBatch returned', result)
135
135
  this.stats.sqsCalls++
136
+ if (result.Failed) {
137
+ console.error('FAILED_MESSAGES', result.Failed)
138
+ for (const failed of result.Failed) {
139
+ console.error('FAILED_TO_EXTEND_JOB', this.jobsByMessageId[failed.Id])
140
+ }
141
+ }
136
142
  if (result.Successful) {
137
143
  const count = result.Successful.length || 0
138
144
  this.stats.timeoutsExtended += count
@@ -156,7 +162,7 @@ export class JobExecutor {
156
162
  while (messageId++ < 10 && jobsToDelete.length) {
157
163
  const job = jobsToDelete.shift()
158
164
  const entry = {
159
- Id: '' + messageId,
165
+ Id: job.message.MessageId,
160
166
  ReceiptHandle: job.message.ReceiptHandle,
161
167
  VisibilityTimeout: job.visibilityTimeout
162
168
  }
@@ -169,6 +175,12 @@ export class JobExecutor {
169
175
  debug({ DeleteMessageBatch: input })
170
176
  const result = await getSQSClient().send(new DeleteMessageBatchCommand(input))
171
177
  this.stats.sqsCalls++
178
+ if (result.Failed) {
179
+ console.error('FAILED_MESSAGES', result.Failed)
180
+ for (const failed of result.Failed) {
181
+ console.error('FAILED_TO_DELETE_JOB', this.jobsByMessageId[failed.Id])
182
+ }
183
+ }
172
184
  if (result.Successful) {
173
185
  const count = result.Successful.length || 0
174
186
  this.stats.jobsDeleted += count