You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When feed is set to disable elements, every single element is explicitly set to $element->enabled = false; and then saved, even if it already was disabled. When keeping disabled elements around, this can massively slow down the feed completion, as well as using unnecessary resources resaving a lot of elements.
A simple if to check if an element is already disabled, and then only save it if it is enabled, sped up my feed completion from 44.82s to 2.25s(!), although mileage of course may very. (I use Feed Me to sync content from an external source, running every hour, so most of the time there are no big changes).
Even if the gains are not so huge in every scenario, it seems a little bit like a simple no-brainer that can't really negatively impact anyone.
I already have a PR for this from August 2020: #736
Steps to reproduce
Set up feed with import strategy to disable missing elements
Have a substantial amount of disabled elements
Wait, wait and wait for the import to complete while it's disabling already disabled elements
Additional info
Craft version: 4.3.8.2
PHP version: 8.0.26
Database driver & version: MySQL 10.4.27
Plugins & versions: FeedMe 5.0.5 (but basically any version)
The text was updated successfully, but these errors were encountered:
I see that the old pull request has a conflict now because of extra parameters in the saveElement method. But it should suffice to go from this in src/base/Element.php:
Description
When feed is set to disable elements, every single element is explicitly set to
$element->enabled = false;
and then saved, even if it already was disabled. When keeping disabled elements around, this can massively slow down the feed completion, as well as using unnecessary resources resaving a lot of elements.A simple
if
to check if an element is already disabled, and then only save it if it is enabled, sped up my feed completion from 44.82s to 2.25s(!), although mileage of course may very. (I use Feed Me to sync content from an external source, running every hour, so most of the time there are no big changes).Even if the gains are not so huge in every scenario, it seems a little bit like a simple no-brainer that can't really negatively impact anyone.
I already have a PR for this from August 2020:
#736
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: