Bad performance of term registration with JsonAPI when there are many terms with the same name.

Created on 7 August 2023, 11 months ago

Problem/Motivation

Load terms with the same name one by one in order to obtain a unique ID when automatically generating machine_name in taxonomy_machine_name_uniquify.
Depending on the number of terms registered, the time to obtain a unique ID will be delayed.

Below is part of taxonomy_machine_name_uniquify.

  $i = 0;
  do {
    // Append an incrementing numeric suffix until we find a unique value.
    $unique_suffix = '_' . $i;
    $machine_name = Unicode::truncate(
        $original_machine_name,
        255 - mb_strlen($unique_suffix)
      ) . $unique_suffix;
    $i++;
  } while (taxonomy_term_machine_name_load($machine_name, $term->bundle()));

Is this what is supposed to be?

πŸ› Bug report
Status

Active

Component

Taxonomy

Created by

πŸ‡―πŸ‡΅Japan Hiroyuki Takahashi

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

Comments & Activities

Production build 0.69.0 2024