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

Disable auto cache purging when WP_IMPORTING is defined #4226

Closed
jmslbam opened this issue Aug 5, 2021 · 3 comments · Fixed by #6274
Closed

Disable auto cache purging when WP_IMPORTING is defined #4226

jmslbam opened this issue Aug 5, 2021 · 3 comments · Fixed by #6274
Assignees
Labels
module: cache needs: documentation Issues which need to create or update a documentation needs: testing priority: low Issues that can wait type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@jmslbam
Copy link
Contributor

jmslbam commented Aug 5, 2021

Is your feature request related to a problem? Please describe.
When running a custom import via cronjob on a production site with WP Rocket enabled, the cache clearing (rocket_clean_domain) make the import mega slow.

Describe the solution you'd like
Instead of remove all actions like here, https://github.com/wp-media/wp-rocket-helpers/blob/master/cache/wp-rocket-no-cache-auto-purge/wp-rocket-no-cache-auto-purge.php, just don't add the actions when WP_IMPORTING is defined.

Describe alternatives you've considered
Add --skip-plugin=wp-rocket with our custom WP-CLI command.

@Tabrisrp Tabrisrp added module: cache type: enhancement Improvements that slightly enhance existing functionality and are fast to implement needs: grooming labels Aug 23, 2021
@Tabrisrp
Copy link
Contributor

Scope a solution ✅

I'm tempted to go further and bail-out from WP Rocket loading if WP_IMPORTING is defined. This would be the same as we do for when DOING_AUTOSAVE is defined.

We can add the constant check in rocket_init() in inc/main.php.

Estimate the effort ✅

Effort [XS]

@Tabrisrp Tabrisrp added effort: [XS] < 1 day of estimated development time good first issue Indicates a good issue for first-time contributors and removed needs: grooming labels Aug 25, 2021
@piotrbak piotrbak added the priority: low Issues that can wait label Nov 8, 2021
@jmslbam
Copy link
Contributor Author

jmslbam commented Nov 16, 2021

Hola, a question, what is the specific thought about labeling this low?

Every site that is running a proper import via WP-CLI or even via WP All Import or so, wíth WP Rocket enable will profit from this.

I just came back to this ticket, because I have another project which is running a big import which just crashes because WP Rocket clears cache on every single term, post etc creation / update.

In this case the import is done via WP All Import.

Regards,

Jaime

@jmslbam
Copy link
Contributor Author

jmslbam commented Nov 18, 2021

Maybe this following method is a better solution, add a filter to disable the clearing of the cache.

So default is true, but through the filter it can be disabled. This way the person who is doing the import needs to disable WP Rocket knowingly and will start the generation of the cache after a import is finished.

Example from SearchWP but FacetWP and ElasticPress have a similiar filter.

add_filter( 'searchwp\index\process\enabled', '__return_false' )

Most of my bigger projects run SearchWP and FacetWP and a import, so it puts quit some stress on the server that on every post and/or creation and/or update it reindexes the SearchWP, FacetWP && clears the WP Rocket cache.

Hope the filter is a implementation where you can stand behind.

Kinds regards,

Jaime

@piotrbak piotrbak added this to the 3.10.5 milestone Nov 19, 2021
@Tabrisrp Tabrisrp self-assigned this Nov 22, 2021
@Tabrisrp Tabrisrp removed this from the 3.10.5 milestone Dec 6, 2021
@piotrbak piotrbak added this to the 3.10.6 milestone Dec 7, 2021
@piotrbak piotrbak modified the milestones: 3.10.6, 3.10.7 Jan 4, 2022
@piotrbak piotrbak removed this from the 3.10.7 milestone Jan 21, 2022
@Tabrisrp Tabrisrp added needs: grooming and removed good first issue Indicates a good issue for first-time contributors effort: [XS] < 1 day of estimated development time labels Feb 21, 2022
@Tabrisrp Tabrisrp removed their assignment Feb 28, 2022
@piotrbak piotrbak added this to the 3.15.5 milestone Oct 30, 2023
@Mai-Saad Mai-Saad added the needs: documentation Issues which need to create or update a documentation label Nov 22, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 22, 2023
Co-authored-by: mostafa-hisham <mostafa.hisham.mahmoud@gmail.com>
Co-authored-by: Rémy Perona <remperona@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cache needs: documentation Issues which need to create or update a documentation needs: testing priority: low Issues that can wait type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
6 participants