Problem/Motivation
#3337513: Fix batch process race conditions by making ‘bid (batch id)’ auto-increment added the code comment,
try {
$batch['id'] = $batch['progressive'] ? \Drupal::service(BatchStorageInterface::class)->getId() : 'non-progressive';
}
catch (IntegrityConstraintViolationException) {
// @todo this is here to support the update path to deprecate
// Connection::nextId(). Remove in Drupal 11.
// ...
}
but Drupal 11 is here and that try/catch block has not been removed.
Proposed resolution
Remove the try/catch block.
Remaining tasks
User interface changes
None
Introduced terminology
None
API changes
None
Data model changes
None
Release notes snippet
N/A
Issue fork drupal-3496403
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3496403-obsolete-trycatch-batch-id
changes, plain diff MR !10727
Comments
Comment #2
benjifisherComment #3
benjifisherComment #5
benjifisherI ran across this code comment while reviewing #1986330: When Batch ID doesn't exist, Drupal should emit a 404.
Without thinking about it too hard, I implemented the
@todocomment and removed the try/catch block. If the tests pass, then I guess I interpreted it correctly.Comment #6
smustgrave commentedBelieve your interpretation is correct. I helped with a number of deprecation removals for D11 but wasn't looking for this pattern. Since nextId was removed this should be fine.
Comment #7
quietone commentedYes, this removal looks correct.
Comment #9
catchCommitted/pushed to 11.x, thanks!