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

Disregard transient cache in perflab_query_plugin_info() when a plugin is absent #1617

Open
westonruter opened this issue Oct 21, 2024 · 3 comments · May be fixed by #1694
Open

Disregard transient cache in perflab_query_plugin_info() when a plugin is absent #1617

westonruter opened this issue Oct 21, 2024 · 3 comments · May be fixed by #1694
Labels
[Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@westonruter
Copy link
Member

This is a follow-up to #1613 specifically to @joemcgill's suggestion:

Oh, additionally, we should probably update the logic below so that if a slug is not found in the cache, it tries to request it from the API instead of returning a WP_Error right away.

When a new feature plugin is published, it may not yet exist in the perflab_plugins_info-v2 transient. Therefore, whenever one of the expected $standalone_plugins is absent, we should act as if the transient was not set in the first place so that we can obtain the latest plugin info right away.

Related: #1616

@westonruter westonruter added [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature labels Oct 21, 2024
@westonruter westonruter added this to the performance-lab n.e.x.t milestone Oct 21, 2024
@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Oct 21, 2024
@westonruter westonruter moved this from Not Started/Backlog 📆 to To Do 🔧 in WP Performance 2024 Oct 21, 2024
@swissspidy
Copy link
Member

When we do this we can probably rename the transient back to perflab_plugins_info

@westonruter
Copy link
Member Author

Yes, by then any existing transients with the old key should have expired as well.

@felixarntz
Copy link
Member

felixarntz commented Oct 21, 2024

While the idea behind this enhancement makes sense to me, we need to be cautious about this: The reason it's implemented the way it is now is to not cause endless re-attempts of the request when plugin data is not available, which can temporarily happen for one reason or another. In other words, failed lookups still need to be cached.

We will need to implement this in a way that differentiates between:

  • Was plugin data not found by the request?
  • Is plugin data not present in the cache because the plugin was newly added to the list in Performance Lab?

I would suggest we do something like cache a value like false for every plugin that we requested data for at the time of the request. This way we can differentiate between ! isset( $plugins[ $slug ] ) (new plugin, so ignore the cache and make the request) vs ! $plugins[ $slug ] (plugin data was already requested but not found).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature
Projects
Status: To Do 🔧
Development

Successfully merging a pull request may close this issue.

3 participants