Create way to ignore certain sources

Created on 11 December 2023, about 1 year ago
Updated 14 December 2023, about 1 year ago

Problem/Motivation

I have a site with a few node bundles that are imported from an API via a migration on a continual basis that are locked for editing, as well as node bundles that can be edited. The migrated nodes make up 3/4 of all nodes but I'm not interested in tracking entity usage for them. Currently this makes re-calculating usage via batch API very slow. Haven't tested but would probably make migrations slow too as every time an item is migrated it would calculate usages.

Steps to reproduce

N/A

Proposed resolution

Provide way to filter out certain content types via an event.

Remaining tasks

Dispatch new event

User interface changes

N/A

API changes

New event called ALTER_SOURCE_BUNDLES

Data model changes

N/A

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

achap 🇦🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @achap
  • Merge request !59Resolve #3407810 "Create way to" → (Open) created by achap
  • Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    Waiting for branch to pass
  • 🇪🇸Spain marcoscano Barcelona, Spain

    Can't you use hook_entity_usage_block_tracking() for this?

  • achap 🇦🇺

    Based on my understanding that hook is called after all the batches have been queued for processing, so it's too late for my use case. I want to prevent them from being included in the queue in the first place as in my case removing them gets rid of about 20,000 nodes that need to be processed.

    Although dispatching the event in EntityUpdateManager is probably not necessary as in that case the event would already have been fired if we are coming from a batch process, or we are just saving an individual node. So in the latter case I could just use the hook.

  • Status changed to Needs review about 1 year ago
  • achap 🇦🇺

    Also, I'm not entirely sure if the test fails are due to my new code because the tests were already failing on the upstream branch

Production build 0.71.5 2024