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

Boost: Cleanup minify schedules on deactivation #41667

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

donnchawp
Copy link
Contributor

@donnchawp donnchawp commented Feb 10, 2025

The 404 tester and cache clean up need to be unscheduled if neither of the concatenation modules is active. This PR checks that and removes the scheduled jobs.

Proposed changes:

  • Call jetpack_boost_minify_deactivation() from the deactivate functions of the css and js minification classes
  • Add jetpack_boost_minify_deactivation function that checks if either of those modules is enabled, and removes the jetpack_boost_404_tester_cron and jetpack_boost_minify_cron_cache_cleanup scheduled events if not.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Install the WP Cron Control plugin.
  • Apply PR.
  • Enable both concatenation modules and confirm the jetpack_boost_404_tester_cron and jetpack_boost_minify_cron_cache_cleanup events are scheduled daily;
  • Disable both modules and make sure both events are gone.

@donnchawp donnchawp added [Pri] High [Status] Needs Team Review [Plugin] Boost A feature to speed up the site and improve performance. labels Feb 10, 2025
@donnchawp donnchawp added this to the boost/3.9.0 milestone Feb 10, 2025
@donnchawp donnchawp requested a review from a team February 10, 2025 10:04
@donnchawp donnchawp self-assigned this Feb 10, 2025
Copy link
Contributor

github-actions bot commented Feb 10, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Boost plugin:

  • Next scheduled release: February 13, 2025.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Feb 10, 2025
Copy link
Contributor

github-actions bot commented Feb 10, 2025

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/boost/app/modules/optimizations/minify/class-minify-css.php 0/15 (0.00%) 0.00% 1 ❤️‍🩹
projects/plugins/boost/app/modules/optimizations/minify/class-minify-js.php 0/15 (0.00%) 0.00% 1 ❤️‍🩹
projects/plugins/boost/app/lib/minify/functions-helpers.php 0/130 (0.00%) 0.00% -1 💚

Full summary · PHP report · JS report

@donnchawp donnchawp added [Type] Bug When a feature is broken and / or not performing as intended and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 10, 2025
LiamSarsfield
LiamSarsfield previously approved these changes Feb 10, 2025
Copy link
Contributor

@LiamSarsfield LiamSarsfield left a comment

Choose a reason for hiding this comment

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

LGTM, and testing works as expected.
Though not sure if this is expected: I noticed that WP Crontrol sets the action for the jetpack_boost_minify_cron_cache_cleanup cron as None when both Minifies are disabled. But sets it to jetpack_boost_page_optimize_cache_cleanup when at least one is enabled.
Screenshot 2025-02-10 at 12 49 12
Screenshot 2025-02-10 at 12 51 14

Copy link
Member

@dilirity dilirity left a comment

Choose a reason for hiding this comment

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

Just so we don't forget it.

As per the discussion in slack, we need to clear the static cleanup schedule as well.

@dilirity
Copy link
Member

Minify changes introduced yesterday were moved to a separate PR to avoid scope creep here.

@dilirity dilirity marked this pull request as ready for review February 11, 2025 13:21
@dilirity dilirity requested a review from a team February 11, 2025 13:22
@dilirity dilirity changed the title Boost: Unschedule the 404 tester if not needed Boost: Cleanup minify schedules on deactivation Feb 11, 2025
@haqadn haqadn modified the milestone: boost/3.9.0 Feb 11, 2025
LiamSarsfield
LiamSarsfield previously approved these changes Feb 11, 2025
Copy link
Contributor

@LiamSarsfield LiamSarsfield left a comment

Choose a reason for hiding this comment

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

LGTM 🙌

haqadn
haqadn previously requested changes Feb 11, 2025
Copy link
Contributor

@haqadn haqadn left a comment

Choose a reason for hiding this comment

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

During my testing, I found that the schedule for jetpack_boost_minify_cron_cache_cleanup is not registering. Please do not merge until I find out more about the issue.

@haqadn haqadn dismissed their stale review February 11, 2025 22:07

The cron wasn't registering during my tests. I am not sure if it's this PR or trunk. But, I found that the overall gc cron for minify was confusing because it was referencing both the legacy directory and new static cache directory at the same time. So, I've tried to refactor this a little bit and fix the cron registration issue in 83a9509.

@haqadn haqadn requested a review from LiamSarsfield February 11, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Boost Feature] Minify [Plugin] Boost A feature to speed up the site and improve performance. [Pri] High [Status] Needs Team Review [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants