-
Notifications
You must be signed in to change notification settings - Fork 27
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
cache imagify user response even in case of error #916
Conversation
After testing a bit, the only impact I could see is when someone enters a wrong API key, navigates a bit the admin, then enters a valid key. After this, it takes a few minutes for the admin bar to display the license and quota. |
@wordpressfan confirmed it should be working to reduce 401: https://wp-media.slack.com/archives/CU0F6EGQ1/p1731051235420369?thread_ts=1730995819.928759&cid=CU0F6EGQ1 I played a bit with the version and it seems working on my end. |
@wordpressfan Thanks for the PR.
Note: initial test plan is here as per requirements from discussions https://wpmediaqa.testrail.io/index.php?/runs/view/927&group_by=cases:section_id&group_order=asc |
Also, move the transient logic to be inside get_imagify_user function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Fixes the increase of requests to the Imagify API after release of 2.2.3
Users might be impacted as the fetching of information about their subscription from the API will now be delayed by 5 minutes in case of error on the first try. As a result, some data might not be available for 5 minutes initially if there was an issue when fetching the user data. It will be automatically retried after 5 minutes.
Type of change
Detailed scenario
If you don't have a valid API key for instance, Imagify plugin currently tries to fetch user data on each admin page opening. After this fix, the call should happen only once every 5 minutes.
Technical description
Documentation
We now store the result of get_imagify_user even in case of error, so that this result can be reused next time it is needed without doing again a call to the API.
New dependencies
List any new dependencies that are required for this change.
Risks
If a user fixes the issue, some part of the admin dashboard might take 5 minutes to get updated. For instance, after setting up the API key, the account information might not be available immediately.
Mandatory Checklist
Code validation
Code style
Additional Checks