Patch is created against 7.x-2.0-alpha1+3-dev

So I made this patch because I noticed that when deleting nodes which have references to other deleted nodes, the ref_field module actually 500 Fatal errors.

This is because ref_field module, assumes the entity loads correctly, then attempts to delete the references on a NULL object.

While looking in to this issue I also noticed that sub-optimal use was going on. The author was collecting nids into arrays, then going through the arrays one by one and entity_load()'ing the entities. entity_load can simply take an array of nids....and this greatly reduces the amount of DB queries (one per field, instead of one per field TIMES amount of nodes)

So my patch changes entity_load to load off multiple IDs...then off the loaded references passes them to the "add" or "remove" functions. This makes sure that only nodes which exist get passed and no "null" results.

Two birds, one stone.

It's a re-factor and no API change, so I think assuming my code is correct, this patch can simply get applies with out repercussions.

Comments

j0rd’s picture

Testbot

j0rd’s picture

Testbot needs review.

philipz’s picture

Issue summary: View changes

Is this somehow stuck with review status?

j0rd’s picture

I have a feeling there's no tests for this module.

I've been using this code in production for months though, and it works fine.

oriol_e9g’s picture

Status: Needs review » Reviewed & tested by the community

Works and thousands of sites are using DKAN rolled with this patches and works without related problems.

joseph.olstad’s picture

  • joseph.olstad committed 473dbad on 7.x-2.x authored by j0rd
    Issue #1928680 by j0rd: Performance Killer: Entity Load is loading 1...
joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

creditted j0rd

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.