ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

BUG: EP 4.x - Edit Category update times

Open cmcandrew opened this issue 3 years ago • 4 comments

Describe the bug Experiencing issues updating categories with large number of posts (30k), it takes between 7-27 minutes which on Production causes timeouts

Appears to be triggering a Sync on every Update

Steps to Reproduce

  1. ElasticPress 4.2.2 (any version 4 release)
  2. Full Index via WP-CLI
  3. Edit Category with thousands of posts (30k) and click Update
  4. See error

Expected behavior Category is expected to update within a reasonable amount of time and not in the realms of hitting timeouts

Screenshots EP-4-edit-category-time

cmcandrew avatar Aug 09 '22 09:08 cmcandrew

It seems related to #2924

felipeelia avatar Aug 09 '22 14:08 felipeelia

For users having this problem, the solution outlined in this comment might help:


You can stop ElasticPress from indexing on a taxonomy edit:

add_filter(` 'ep_skip_action_edited_term', '__return_true' );

If you want to make that decision based on the number of posts associated with the term in question, you can use a code like this:

function ep_2933_skip_action_edited_term( $skip, $term_id, $tt_id, $taxonomy, $object_ids ) {
	return ( count( $object_ids ) > 100 ) ? true : $skip; // Change 100 to the number you want
}
add_filter( 'ep_skip_action_edited_term', 'ep_2933_skip_action_edited_term', 10, 5 );

Just keep in mind that you will need to manually sync everything once you have made all the changes you need.

felipeelia avatar Sep 15 '22 14:09 felipeelia

Hi @felipeelia is this posed as a workaround solution until a proper fix is implemented?

cmcandrew avatar Sep 16 '22 08:09 cmcandrew

Hey @cmcandrew, yes. The problem with this one is how we will want to "fix" it. We have a couple of options:

  1. Make the opposite of how we have it today: totally disable syncs for edited terms, and make it opt-in.
  2. (The easiest) Only sync when a term with a certain number of posts is edited.
  3. (The optimal) Only sync that specific field of all posts, potentially sending a much smaller request. For this, we will need to create a mechanism to sync parts of posts.

We will talk about it during our next internal sync and plan accordingly for the next releases.

felipeelia avatar Sep 16 '22 12:09 felipeelia