Delete flag's flaggings in a batch on entity delete

Created on 13 January 2021, almost 4 years ago
Updated 7 June 2024, 6 months ago

Problem/Motivation

When attempting to delete a flag with thousands of flaggings, the regular core entity delete behavior will run out of memory attempting to delete all the flaggings.

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

Delete a flag's flagging entities in a batch operation.

Remaining tasks

Review and improve initial approach. I have attempted to use as much as the extending entity delete functionality as possible, but it does lead to some oddities (e.g. the entity deleted message and log is added before the batch operation completes).

User interface changes

None.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Needs review

Version

4.0

Component

Flag core

Created by

πŸ‡ΊπŸ‡ΈUnited States wells Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024