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

Stop the Sync process if mapping failed #3206

Merged
merged 14 commits into from
Jan 4, 2023
Merged

Stop the Sync process if mapping failed #3206

merged 14 commits into from
Jan 4, 2023

Conversation

burhandodhy
Copy link
Contributor

@burhandodhy burhandodhy commented Dec 14, 2022

Description of the Change

This PR updates the put_mapping method to return the WP_ERROR object in case there is issue while doing the mapping. The main reason to doing this is so we can stop the sync if there is an error and also shows the error message in dashboard and WP CLI command

Closes #3204

How to test the Change

  1. Add this filter to enforce the mapping fail
add_filter(
	'ep_config_mapping_request',
	function() {
		return new \WP_Error( 'test', 'This was forced to fail' );
	}
);
  1. Run the sync from dashboard and make sure the sync stopped and the message is logged
  2. Run put-mapping command and it should display the error message

Changelog Entry

Changed - put-mapping wpcli returns error message if mapping failed
Fixed - Stopped Sync if put mapping throws error.

Credits

Props @burhandodhy @felipeelia

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@burhandodhy burhandodhy changed the title [WIP] Stop the Sync process if mapping failed Stop the Sync process if mapping failed Dec 15, 2022
@burhandodhy burhandodhy marked this pull request as ready for review December 15, 2022 07:20
includes/classes/Command.php Outdated Show resolved Hide resolved
includes/classes/Elasticsearch.php Outdated Show resolved Hide resolved
includes/classes/Elasticsearch.php Outdated Show resolved Hide resolved
@felipeelia felipeelia added this to the 4.4.1 milestone Jan 4, 2023
includes/classes/IndexHelper.php Outdated Show resolved Hide resolved
@felipeelia felipeelia merged commit 677bc8a into develop Jan 4, 2023
@felipeelia felipeelia deleted the fix/3204 branch January 4, 2023 19:19
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.

Stop the Sync process if mapping failed
3 participants