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

Update WordPress Importer plugin to include post_type in the query for existing post #5410

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dhusakovic
Copy link

@dhusakovic dhusakovic commented Apr 4, 2024

Description

The post import process uses post_exists function to check whether each of the importing posts already exists. The query utilises the title and date parameters for this search, which will run through all the posts to try and find a match.

In cases where we have a large number of posts this process times out and the import fails.

Passing the post_type to post_exists function allows us to use the type_status_date key, which significantly drops the number of rows examined and the overall query time in certain instances, depending on how many posts of that post_type we have.

Changelog Description

Update to WordPress Importer plugin to improve the post_exists query time during post import process.

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally (or has an appropriate fallback).
  • This change works and has been tested on a Go sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

@dhusakovic dhusakovic requested a review from a team as a code owner April 4, 2024 23:15
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.99%. Comparing base (795d517) to head (babe522).
Report is 429 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #5410      +/-   ##
=============================================
- Coverage      29.03%   28.99%   -0.05%     
  Complexity      4825     4825              
=============================================
  Files            283      283              
  Lines          20954    20942      -12     
=============================================
- Hits            6085     6073      -12     
  Misses         14869    14869              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Apr 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@rebeccahum rebeccahum left a comment

Choose a reason for hiding this comment

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

Hi @dhusakovic, thanks for the PR! Would it be possible to do the change upstream so that when we update it to the latest version, the change doesn't get overwritten? https://github.com/WordPress/wordpress-importer

@dhusakovic
Copy link
Author

@rebeccahum I've created an issue and suggested the change here WordPress/wordpress-importer#162. Can we still push the update here while we wait for the upstream changes?

@rebeccahum
Copy link
Contributor

rebeccahum commented Apr 9, 2024

@dhusakovic I'd prefer to keep it in sync with upstream to ensure it doesn't get overwritten with the way we have many moving parts in MU-plugins! However, I looked at the upstream issue and it looks like your suggestion would be a welcome change in a PR 🙂.

Copy link
Contributor

This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed.

This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved.

Copy link
Contributor

This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed.

This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved.

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.

3 participants