Commit d9dddf5a authored by Rich Gerdes's avatar Rich Gerdes Committed by vincent baronnet
Browse files

Issue #3249712 by richgerdes: Checking the route_rebuild lock has a huge performance implication

parent 72581941
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -202,10 +202,6 @@ function domain_entity_query_alter(AlterableInterface $query) {
    // Do not fire at install & update time.
    return;
  }
  if (!\Drupal::lock()->lockMayBeAvailable('router_rebuild')) {
    // Do not fire at route rebuild time.
    return;
  }
  if (!\Drupal::config('domain_entity.settings')->get('bypass_access_conditions') && method_exists($query, 'getTables')) {
    // Have we to check access for this entity types.
    $allowed_types = domain_entity_allowed_entity_types();
@@ -218,6 +214,10 @@ function domain_entity_query_alter(AlterableInterface $query) {
    if (!$query->hasTag($entity_type_id . '_access')) {
      return;
    }
    if (!\Drupal::lock()->lockMayBeAvailable('router_rebuild')) {
      // Do not fire at route rebuild time.
      return;
    }
    // Get primary key of base table from entity type definition.
    $entity_key = $allowed_types[$entity_type_id]->getKey('id');