Problem/Motivation

Split from #2489992: Do not delete flaggings on account cancelation

Deleting a large amount of flaggings can cause a project to run out of time / memory.

Steps to reproduce

Create a flag and add a high number of flaggings (e.g. 50k).

Attempt to delete the flag from /admin/structure/flags.

The operation will fail when PHP runs out of memory while attempting to delete all related flagging entities.

Proposed resolution

Use a queue when deleting a large set of flaggings

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit

User interface changes

None

API changes

Large amount of flaggings are deleted in a queue

Data model changes

None

Issue fork flag-3633556

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

idebr created an issue. See original summary.

idebr’s picture

idebr’s picture

Status: Active » Needs work
Issue tags: +Needs tests
idebr’s picture

Version: 5.1.x-dev » 5.2.x-dev
idebr’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Added test coverage in a new \Drupal\Tests\flag\Kernel\FlagServiceRemovalQueueTest

ivnish’s picture

Version: 5.2.x-dev » 5.3.x-dev
Category: Task » Feature request
ivnish’s picture

Status: Needs review » Needs work

Needs to fix phpstan in test