bluehost / endurance-page-cache

Other
25 stars 12 forks source link

Cache the update request #55

Closed afragen closed 5 years ago

afragen commented 5 years ago

Set a transient to cache the update wp_remote_get request as these take time.

afragen commented 5 years ago

I’m using get_transient() and set_transient() but not sure if we should be using get_site_transient() and set_site_transient()

wpscholar commented 5 years ago

@afragen Thanks! You are doing it correctly. The get_site_transient() and set_site_transient() functions are multisite specific.

wpscholar commented 5 years ago

@afragen Looking closer, I question whether these changes are even necessary.

1) WordPress only makes plugin update requests every 12 hours. 2) The update() method in this file is never called, which makes me think this is dead code that can be removed. I highly doubt anything externally calls this method.

@MikeHansenMe Any reason we should keep the update() method?

afragen commented 5 years ago

@wpscholar as someone who has views plugins.php a lot, I can tell you the call goes out more than every 12 hours and sometimes more than one per page load. Specifically I think it also happens if another plugin might call those functions or interact with the update transient in some manner or using the pre_set_site_transient_update_plugins filter.

screenshot_03

afragen commented 5 years ago

All requested changes have been made.

wpscholar commented 5 years ago

@afragen Just out of curiosity, do you know what is actually triggering the call to the update() method? I can't see anything that calls it.

afragen commented 5 years ago

I believe it’s any other plugin that is also calling add_filter( 'pre_set_site_tramsient_update_plugins', … ); or possibly anything that does set_site_transient('update_plugins');

My current version of GitHub Updater does that.