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

Closes #6474: Update maintenance LCP/ATF #6489

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Mar 19, 2024

Description

Fixes #6474

Documentation

User documentation

This allow to delete old OR failed results from LCP / ATF.

The rocket_atf_cleanup_interval filter is a new feature introduced in this PR. It allows developers to modify the interval at which the Above The Fold (ATF) cleanup process considers a row to be old and therefore eligible for deletion. By default, this interval is set to 1 month. If a row's last_accessed date is more than 1 month ago, it will be deleted during the cleanup process. However, by using this filter, developers can change this interval. For example, if the interval is set to 2 months, then the cleanup process will delete rows where the last_accessed date is more than 2 months ago. Here's an example of how to use this filter:

// Change the ATF cleanup interval to 2 months.
add_filter( 'rocket_atf_cleanup_interval', function() {
    return 2;
});

Technical documentation

  • The schedule_atf_cleanup method is used to schedule the 'above the fold' cleanup process to run daily. It checks if the cleanup process is already scheduled using the wp_next_scheduled function. If it's not scheduled, it schedules the event using the wp_schedule_event function.
  • The atf_cleanup method is used to execute the 'above the fold' cleanup process. It calls the delete_old_rows method of the ATFTable class to delete the rows with failed status or not accessed since the interval.
  • The unschedule_atf_cleanup method is used to unschedule the above the fold cleanup process. It gets the timestamp of the next scheduled cleanup using the wp_next_scheduled function. If a timestamp is found, it unschedules the event using the wp_unschedule_event function

Type of change

Delete options that are not relevant.

  • Enhancement (non-breaking change which improves an existing functionality).

New dependencies

Risks

Checklists

Feature validation

  • I validated all the Acceptance Criteria. If possible, provide sreenshots or videos.
  • 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

  • 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

  • I wrote self-explanatory code about what it does.
  • I wrote comments to explain why it does it.
  • I named variables and functions explicitely.
  • I protected entry points against unexpected inputs.
  • I did not introduce unecessary complexity.
  • I listed the introduced external dependencies explicitely on the PR.
  • 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.

@Miraeld Miraeld added the lcp label Mar 19, 2024
@Miraeld Miraeld added this to the 3.16 milestone Mar 19, 2024
@Miraeld Miraeld requested a review from a team March 19, 2024 06:28
@Miraeld Miraeld self-assigned this Mar 19, 2024
@Miraeld Miraeld changed the base branch from develop to feature/lcp-above-the-fold-optimization March 19, 2024 06:28
@Miraeld Miraeld force-pushed the enhancement/6474-update-maintenance-lcp branch from 2f0350e to 9b098e8 Compare March 19, 2024 09:35
@Miraeld Miraeld force-pushed the enhancement/6474-update-maintenance-lcp branch from 1584ea4 to 127b57f Compare March 20, 2024 12:23
@Miraeld Miraeld merged commit b271071 into feature/lcp-above-the-fold-optimization Mar 20, 2024
2 of 7 checks passed
@Miraeld Miraeld deleted the enhancement/6474-update-maintenance-lcp branch March 20, 2024 13:22
@Mai-Saad
Copy link
Contributor

Mai-Saad commented Apr 23, 2024

Related test plan https://wpmediaqa.testrail.io/index.php?/runs/view/845&group_by=cases:section_id&group_id=5031&group_order=asc

For exploratory :

  • never cache/always purge with the feature (with never cache, URL won't have lcp nor added to atf on visit. While for always purge, edit URL x will clear only the URL in always Purge from cache but not atf table as in RUCSS) ✔️

@Miraeld
Copy link
Contributor Author

Miraeld commented Apr 24, 2024

Here is the related test results:
testrail-report-597.pdf

@MathieuLamiot
Copy link
Contributor

MathieuLamiot commented Apr 24, 2024

Step 4 of https://wpmediaqa.testrail.io/index.php?/tests/view/41770&group_by=cases:section_id&group_id=5031&group_order=asc worked for me 🤔
For step 3, I don't have the "Clear for this URL" but only "Clear Used CSS" which seem to clear all LCP/ATF.

Probably @wp-media/qa-team can manually run those two steps to confirm for us 😬

@MathieuLamiot
Copy link
Contributor

After discussion with @piotrbak and checking, the test plan is OK for LCP/ATF and failing parts are also failing on trunk:

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.

Update maintenance for LCP/ATF data storage
4 participants