wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Enhance rocket_url_to_postid function to search only in specific post statuses to make it faster

Open wordpressfan opened this issue 1 year ago • 1 comments

Description

Fixes #5971

Documentation

User documentation

For websites that have too much posts (for the customer's test site, there were about 5000 woocommerce products there), this will make it faster when saving posts.

Technical documentation

Here we changed the WP_Query that we use inside the function rocket_url_to_postid to search only inside posts with specific statuses and in preload when we run the code to exclude private posts we search only in private posts.

Type of change

Delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue).
  • [ ] Enhancement (non-breaking change which improves an existing functionality).

New dependencies

No

Risks

No risks at all, it's just enhancing the current situation but won't provide more issues.

Checklists

Feature validation

  • [x] I validated all the Acceptance Criteria. If possible, provide sreenshots or videos.
  • [x] I triggered all changed lines of code at least once without new errors/warnings/notices.
  • [ ] I implemented built-in tests to cover the new/changed code.

Documentation

  • [x] I prepared the user documentation for the feature/enhancement and shared it in the PR or the GitHub issue.
  • [ ] The user documentation covers new/changed entry points (endpoints, WP hooks, configuration files, ...).
  • [ ] I prepared the technical documentation if needed, and shared it in the PR or the GitHub issue.

Code style

  • [x] I wrote self-explanatory code about what it does.
  • [x] I wrote comments to explain why it does it.
  • [x] I named variables and functions explicitely.
  • [ ] I protected entry points against unexpected inputs.
  • [x] I did not introduce unecessary complexity.
  • [ ] I listed the introduced external dependencies explicitely on the PR.
  • [x] I validated the repo-specific guidelines from CONTRIBUTING.md.

Observability

  • [ ] I handled errors when needed.
  • [ ] I wrote user-facing messages that are understandable and provide actionable feedbacks.
  • [ ] I prepared ways to observe the implemented system (logs, data, etc.).

Risks

  • [x] I explicitely mentioned performance risks in the PR.
  • [ ] I explicitely mentioned security risks in the PR.

wordpressfan avatar Feb 15 '24 09:02 wordpressfan

Test plan is here https://wpmediaqa.testrail.io/index.php?/runs/view/818

Mai-Saad avatar Feb 19 '24 11:02 Mai-Saad