Skip to content

Commit

Permalink
fix bug where failed change/deletes were kept around, tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwitt committed May 14, 2024
1 parent 21d193b commit e0b3ca5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function getMessages (qrl, opt, maxMessages) {
MaxNumberOfMessages: maxMessages,
MessageAttributeNames: ['All'],
QueueUrl: qrl,
VisibilityTimeout: 60,
VisibilityTimeout: 120,
WaitTimeSeconds: opt.waitTime
}
const response = await getSQSClient().send(new ReceiveMessageCommand(params))
Expand Down
6 changes: 5 additions & 1 deletion src/scheduler/jobExecutor.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export class JobExecutor {
console.error('FAILED_MESSAGES', result.Failed)
for (const failed of result.Failed) {
console.error('FAILED_TO_EXTEND_JOB', this.jobsByMessageId[failed.Id])
// ensure that we clean this one up so it doesn't generate api calls
this.jobsbymessageid[failed.id].status = 'failed'
}
}
if (result.Successful) {
Expand Down Expand Up @@ -210,6 +212,8 @@ export class JobExecutor {
console.error('FAILED_MESSAGES', result.Failed)
for (const failed of result.Failed) {
console.error('FAILED_TO_DELETE_JOB', this.jobsByMessageId[failed.Id])
// ensure that we clean this one up so it doesn't generate api calls
this.jobsbymessageid[failed.id].status = 'failed'
}
}
if (result.Successful) {
Expand Down Expand Up @@ -250,7 +254,7 @@ export class JobExecutor {

addJob (message, callback, qname, qrl) {
// Create job entry and track it
const defaultVisibilityTimeout = 60
const defaultVisibilityTimeout = 120
const job = {
status: 'waiting',
start: new Date(),
Expand Down

0 comments on commit e0b3ca5

Please sign in to comment.