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
| Comment | File | Size | Author |
|---|---|---|---|
| optimize-install-hook.patch | 1.98 KB | alieffring |
Issue fork convert_entity_media_embed-3362803
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
Comment #2
damienmckennaSetting to "needs review" as a patch was provided.
Comment #3
damienmckennaAlso related: #3230091: Query bundle key conditionally in install function
Comment #6
s_leu commentedThe posted patch didn't apply any more, I rebased the changes and incorporated the changes mentioned in #3 filing MR5
Comment #7
eelkeblok