Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
og_get_all_group_bundle and og_get_all_group_bundle can be very slow if the need to search through all bundles on all entity_types.
Most times when we call one of these two API functions we are only concerned with the group / group_content bundles that are part of the node entity type. The forthcoming patch will add an optional $entity_type parameter to these functions to prevent cycling over all system bundles.
It just so happens that we have 1k vocabularies that are all iterated over by this function, this changes page load times to 7 seconds.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff-2308279-3-8.txt | 2.04 KB | jacob.embree |
#8 | og-entity_type-parameter-2308279-8.patch | 3.35 KB | jacob.embree |
| |||
#3 | add_entity_type_parameter-2308279-3.patch | 2.26 KB | rbrandon |
Screenshot 2014-07-23 09.27.43.png | 18.53 KB | rbrandon |
Comments
Comment #1
rbrandon CreditAttribution: rbrandon commentedAdds optional $entity_type parameter
Comment #2
rbrandon CreditAttribution: rbrandon commentedComment #3
rbrandon CreditAttribution: rbrandon commentedForgot default parameter for group_content_bundles. Corrected patch.
Comment #5
rbrandon CreditAttribution: rbrandon commentedThis was a big help for us, given the number of bundles we have. https://github.com/openscholar/openscholar/issues/6429#issuecomment-4992...
-Richard
Comment #6
shushu CreditAttribution: shushu commentedComment #7
amitaibuHi @rbrandon :)
PHPdocs.
one liner.
Comment #8
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedThis patch fixes amitaibu's #2. Not sure what #1 and #3 are. Also, documentation improvements are made to the two affected functions.
Comment #9
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedComment #10
torgosPizzaThanks for this patch! I might suggest a small addition, which is the ability for us to configure a default entity type for when the function
og_entity_property_info()
is called, for example:My reasoning is that, in New Relic, I'm seeing og_entity_property_info() get called during cache-rebuild, which occasionally coincides with a customer visiting a page on the site. The resulting cache-setting process results in longer page load times due to the fact that we're currently scanning all entity types. At least this way we can set a default entity and content entity type (in our case, both are just `node`) to prevent extra processing time.