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

Prevent WP Rocket cache from being cleared multiple times #1558

Closed
piotrbak opened this issue Mar 1, 2019 · 5 comments

Comments

5 participants
@piotrbak
Copy link

commented Mar 1, 2019

When a post is being saved using Elementor or Divi Builder (haven't checked other page builders), the 'clean_post_cache' hook is triggered 3 times.

WP Rocket is running the partial cache purging with the array full of posts' related URLs 3 times while saving a single post in this situation.

When external software is being involved in the cache clearing process, there is a possibility that saving post will take much time.

Example:
Varnish cache clearing on Flywheel takes around 0.5-0.7 seconds for each request, which makes saving a post with the above page builders to take approximately 25 seconds (it depends on the number of related posts in the array)

I'm not sure if 3 'clean_post_cache' calls are necessary, on our end we can make sure that WP Rocket's cache is being cleared only after first one:
https://wp-media.slack.com/archives/C43T1AYMQ/p1551450912003800?thread_ts=1551362494.005200&cid=C43T1AYMQ

Related tickets:
https://secure.helpscout.net/conversation/764336044/94386?folderId=2415573
https://secure.helpscout.net/conversation/786974195/98071?folderId=2415573

@Tabrisrp Tabrisrp added this to Triage in Support Wishlist via automation Mar 15, 2019

@alfonso100

This comment has been minimized.

Copy link

commented Mar 15, 2019

I have another case here: https://secure.helpscout.net/conversation/801818620/100294?folderId=2683093

Flywheel is throwing the blame at us, their support team is giving this kind of answers:

We've been seeing this pop up with WP Rocket quite a bit lately. Their plugin automatically detects when a site is on Flywheel and force-enables an addon called Varnish, which doesn't seem to be working very well right now. Whenever WP Rocket is enabled, these slowlog errors pop up during editor saves ->(Screenshot) (Also available by downloading the site logs through the Advanced tab).

We recommend deactivating WP Rocket whenever you are going to be making a lot of edits to the site and then re-enabling it when you are finished. Also, feel free to share this information with WP Rocket's support, we historically like their product and would love for them to get it working better (or at least give the option to deactivate the forced addon that we think is causing the problem).

@webtrainingwheels

This comment has been minimized.

Copy link

commented Mar 16, 2019

This one sounds similar too, although I'm not seeing an obvious page builder listed:
https://secure.helpscout.net/conversation/798299781/99741?folderId=377611

@Tabrisrp Tabrisrp self-assigned this Mar 18, 2019

@Tabrisrp Tabrisrp added this to the 3.3.1 milestone Mar 18, 2019

@Tabrisrp Tabrisrp moved this from Triage to Planned for next version in Support Wishlist Mar 18, 2019

@arunbasillal

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

I am seeing that in general clean_post_cache is called about 4 times when a post is published. Tested this on our mega site by adding this to rocket_clean_post

error_log( "\n post_id = $post_id . Current action / filter = " . current_filter(), 3, dirname(__FILE__) . "/my_error_log.log" );

This is what I logged:

 post_id = 2505 . Current action / filter = clean_post_cache
 post_id = 2505 . Current action / filter = clean_post_cache
 post_id = 2506 . Current action / filter = clean_post_cache
 post_id = 2505 . Current action / filter = clean_post_cache
 post_id = 2505 . Current action / filter = clean_post_cache

2505 is the post ID. 2506 I believe is a revision.

@webtrainingwheels

This comment has been minimized.

@Tabrisrp

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2019

Gutenberge always performs 2 calls to clean_post_cache, and they are not on the same thread (2 different XHR POST request), so we have no way to reduce that.

For the other page builders, we should be able to limit it to 1 time.

@Tabrisrp Tabrisrp moved this from Planned for next version to In progress in Support Wishlist Apr 5, 2019

@Tabrisrp Tabrisrp referenced this issue Apr 16, 2019

Merged

3.3.1 #1648

@Tabrisrp Tabrisrp closed this in 00bfef8 Apr 16, 2019

Support Wishlist automation moved this from In progress to Done Apr 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.