-
Notifications
You must be signed in to change notification settings - Fork 12
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
Async indexing #98
base: release/0.6
Are you sure you want to change the base?
Async indexing #98
Conversation
# Conflicts: # lib/class-sp-post.php # lib/class-sp-sync-manager.php
# Conflicts: # lib/class-sp-post.php # lib/class-sp-sync-manager.php
This reverts commit 088ddb3.
phpcs errors are being fixed in this PR #99 Once that is merged in we can update this PR |
This is affected, and at least somewhat blocked, by WordPress/gutenberg#12903. If this PR is merged as-is, there will potentially be a very small window for a race condition where,
There are ways we could work around this, e.g. by setting the value on the sync flag to |
# Conflicts: # .travis.yml # lib/class-sp-post.php # lib/class-sp-sync-manager.php # tests/test-api.php # tests/test-faceting.php # tests/test-general.php # tests/test-indexing.php # tests/test-integration.php # tests/test-mapping-postmeta.php # tests/test-mapping.php # tests/test-searching.php
} | ||
$to_delete[] = absint( $post_id ); | ||
|
||
update_option( 'sp_delete', array_unique( $to_delete ), 'no' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential overwrite race condition here. Need to figure out a better way to store this data if we're to proceed with this route. Maybe deletes should be synchronous, though?
Added in |
$sync_meta = SP_Sync_Meta(); | ||
|
||
// phpcs:disable WordPress.DB.DirectDatabaseQuery | ||
$post_ids = $wpdb->get_col( "SELECT SQL_CALC_FOUND_ROWS `post_id` FROM {$wpdb->postmeta} WHERE `meta_key`='_sp_index' LIMIT 500" ); // WPCS: cache ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be DISTINCT post_id
in retrospect.
Async Indexing: Remove call to delete post if unindexable because race condition
# Conflicts: # lib/class-sp-sync-manager.php # lib/class-sp-sync-meta.php
This PR replaces synchronous indexing with async indexing. It is a breaking change.
Closes #39, Refs #38, #42, #43
Update 2/2/2024
This is a stable branch in good shape. It was paused due to the Gutenberg issue. I lost touch with that issue, but it's been a long time and perhaps there's a workaround at this point.
I have another note about using
DISTINCT post_id
that should be verified and applied.Otherwise, this should get a fresh set of eyes and let's ship it as isolated as possible in its own release (ideally 0.6).