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

Command icon 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:

Comments

benjifisher created an issue. See original summary.

benjifisher’s picture

Title: Remove obsolete code for batch ID » Remove obsolete try/catch block for batch ID
benjifisher’s picture

Version: 11.1.x-dev » 11.x-dev

benjifisher’s picture

Assigned: benjifisher » Unassigned
Status: Active » Needs review

I 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 @todo comment and removed the try/catch block. If the tests pass, then I guess I interpreted it correctly.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Believe 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.

quietone’s picture

  • catch committed b25c72cd on 11.x
    Issue #3496403 by benjifisher: Remove obsolete try/catch block for batch...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.