-
Notifications
You must be signed in to change notification settings - Fork 8
Issue when no reference fields in nodes #181
Description
Hi team,
Working on EMA UPD project I have detected an issue with oe_media, let me try to explain our case. We have a D8 with more than 180K nodes but there is no nodes with reference fields pointing to media items. Our media items are inserted using paragraphs.
If you got to oe_media.module and review code for oe_media_media_access function, you will see that in line 60 function tries to load all reference fields pointing to media entities. If there is no fields, in line 70 you would build a query where you would load all nids in our database and later (in line 80 you would try to load all those nodes. In our case, loading all nodes will cause an out of memory error.
I have fixed this issue with an extra check of 3 lines of code that I inserted just before we build query to select nodes:
if (empty($field_referenced_to_media)) {
return AccessResult::neutral()->addCacheableDependency($cache);
}
I hope this can be helpful for you. Please, let me know if you need some help or more info about this.