Closed LittleBigThing closed 1 year ago
Am I right we have two options here:
1) re-run test every 24 hours to have fresh data, and no delay in displaying results once a user opens site health. 2) current situation with fresh data upon installing the plugin and opening site health + reload every week as a result of the site health cron + reload once a user opens site health more than 24 hours after the re-run was performed. Bad side of it could be that user misses data as it takes some time to load the sustainability analytics?
My suggestion would be to opt for option two as we cannot afford the Carbon Footprint to re-run the test on a daily base out of sustainability perspective.
I think so.
A fresh test is performed when:
and there is no valid transient set by the plugin.
I’d even propose to run a fresh test only weekly, and thus set a transient for 1 week, equal to Site Health’s cron job. This would also mean that the test result appears quickly when visiting Site Health.
The information provided by the plugin is not meant to be re-checked after each page refresh, but to inform and create awareness. We should refer users, who try to improve their site’s sustainability, directly to the Website Carbon tool to check for improvements.
Based on this discussion and feedback from the creators of the API, I just changed the expiration of the transient to a week, so results are now cached for a week instead of a day.
The result is cached for 24h as a transient. Also, the API caches the result for 24h as well. So it does not seem to make sense to cache for a shorter period, but maybe it does for a longer period to minimise hits to the API?
As a background, Site Health does a cron job weekly. This means that the test runs in the background each week. Since we only cache for a day, chances are big that the test will be performed again when the user visits the Site Health page. It takes a while to get the fresh result, so this might not be ideal. It is indicated that tests are still running, but one might miss the result if not waiting long enough.