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

Cache table exists query duplication

Open wordpressfan opened this issue 8 months ago • 1 comments

Describe the bug When visiting any admin page with Query Monitor plugin active, you will see in the section of duplicate queries the following:

Image

To Reproduce Steps to reproduce the behavior:

  1. Install and activate WP Rocket
  2. Install and activate Query Monitor
  3. In any admin page, check the duplicate queries as in the above screenshot.

Expected behavior We shouldn't have any duplicate queries.

Additional context I believe this is because we initiate this cache table several times and the fix should be here:

https://github.com/wp-media/wp-rocket/blob/10a00a8d579106da31e34469a99aa050b46a9b28/inc/Engine/Preload/ServiceProvider.php#L67

It should use addShared instead of add because this table acts as a subscriber with some callbacks so we need to instantiate it only once.

wordpressfan avatar Apr 09 '25 09:04 wordpressfan

Related: https://secure.helpscout.net/conversation/2899493543/551375

viobru avatar Apr 09 '25 09:04 viobru

Related: https://secure.helpscout.net/conversation/3005178460/574470

joejoe04 avatar Jul 18 '25 16:07 joejoe04