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

CommentFileSizeAuthor
optimize-install-hook.patch1.98 KBalieffring
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

alieffring created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review

Setting to "needs review" as a patch was provided.

s_leu made their first commit to this issue’s fork.

s_leu’s picture

The posted patch didn't apply any more, I rebased the changes and incorporated the changes mentioned in #3 filing MR5

eelkeblok’s picture

Issue tags: +Needs reroll