Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make last_processed_object_id be the last ID of fetched objects #2761

Merged
merged 2 commits into from
May 13, 2022

Conversation

felipeelia
Copy link
Member

Description of the Change

This PR is an attempt to fix the problem outlined in #2755. When the last object of a batch is skipped, the last_processed_object_id isn't properly updated. That is easier to test when indexing only one document at a time (--no-bulk), as the only ID in the queue is the one that was skipped.

Closes #2755

Verification Process

Add a code like this to the codebase:

add_filter(
	'ep_item_sync_kill',
	function( $skip, $object ) {
		return ( 2958 === $object->ID ) ? true : $skip;
	},
	10,
	2
);

And run wp elasticpress index --setup --no-bulk --show-errors --yes

Changelog Entry

Fixed: Sync process with skipped objects.

Credits

Props @juliecampbell @felipeelia

@felipeelia felipeelia added this to the 4.2.0 milestone May 13, 2022
@felipeelia felipeelia self-assigned this May 13, 2022
@felipeelia
Copy link
Member Author

Attaching a zip here, to make things easier for those who can/want to test it: elasticpress.zip

Copy link
Contributor

@tott tott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@felipeelia felipeelia merged commit 4a47911 into develop May 13, 2022
@felipeelia felipeelia deleted the fix/issue-2755 branch May 13, 2022 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using ep_item_sync_kill filter breaks indexing
2 participants