Optimize install hook

Created on 25 May 2023, over 1 year ago
Updated 16 February 2024, 10 months ago

Problem/Motivation

The approach that the module takes to process entities is a little naΓ―ve. It looks at every bundle with a field type that could contain an embed and enqueues every single entity in that bundle for later processing. On sites with large amounts of content this can take a very long time to build the queue, much less process it. We can do better by only enqueuing entities that actually have at least a reasonable chance of containing embeds.

Steps to reproduce

  • Install the module.
  • Marvel at the many thousands of entities to be processed by the queue.

Proposed resolution

When installing the module, only enqueue entities for which at least one of the relevant fields contains an `entity-embed` tag. The query needs to be run per bundle instead of just per content type, and I do hate running an unindexed `LIKE` query against a full text field, but unless you really do have embeds in the vast majority of your content the database hit is more than made up for by the reduced number of queue records that need to be created.

Remaining tasks

Patch attached.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States alieffring

Live updates comments and jobs are added and updated live.
  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024