Skip to content

Ensure that report helper is called when a batch is failed#696

Merged
m90 merged 5 commits into
mainfrom
fr/failed-batch-report
Nov 28, 2023
Merged

Ensure that report helper is called when a batch is failed#696
m90 merged 5 commits into
mainfrom
fr/failed-batch-report

Conversation

@m90

@m90 m90 commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

When deploying #685 I noticed failed batches would not be reported.

It seems tap does not work as I thought it would be and instead of giving us the updated models down the chain, it would re-evaluate the query, yielding 0 results on ->get() as the update just happened and nothing matches the query anymore.

Instead, we can query for candidate ids, update these in a second query and then report.

@m90
m90 force-pushed the fr/failed-batch-report branch from 8528ee5 to ae92c01 Compare November 28, 2023 12:45
@m90
m90 force-pushed the fr/failed-batch-report branch from ae92c01 to 9d4f7fe Compare November 28, 2023 12:58
Comment thread app/Jobs/RequeuePendingQsBatchesJob.php Outdated
Comment thread app/Jobs/RequeuePendingQsBatchesJob.php Outdated
])->get()->pluck('id');
QsBatch::whereIn('id', $failedBatches)->update(['failed' => true]);
});
foreach ($failedBatches as $batchId) {

@m90 m90 Nov 28, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this out of the transaction so we know everything has been committed before we send out the errors.

@m90
m90 force-pushed the fr/failed-batch-report branch from 0a0b470 to d767e74 Compare November 28, 2023 15:25

@tarrow tarrow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this was super easy to read and review.

@m90
m90 merged commit ba3865a into main Nov 28, 2023
@m90
m90 deleted the fr/failed-batch-report branch November 28, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants