Skip to content

Calls to perflab_query_plugin_info() should have WP_Error return cached #1691

@westonruter

Description

@westonruter

We shouldn't directly return WP_Error objects from the logic as that can cause API requests to be made on every page load. Initially we had that fixed, but I see some of the recent changes above already broke that contract, so we should fix it.

I'm fine leaving this here for now as the problem is not strictly introduced by this PR alone, but we should fix it in a follow up PR: Basically, if there's an error, the error should still be cached - either the error directly, or at least an empty array so that the initial error from line 27 is used. It doesn't matter too much that the cached results return the exact same error, but it's crucial that errors don't lead to the request being fired over and over again. What we could do potentially is use a shorter transient expiration if we cache an error response.

Originally posted by @felixarntz in #1680 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Plugin] Performance LabIssue relates to work in the Performance Lab Plugin only[Type] EnhancementA suggestion for improvement of an existing feature

    Projects

    Status

    Done 😃

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions