-
Notifications
You must be signed in to change notification settings - Fork 135
Description
Feature Description
Once a post is published, URL Metrics start to be gathered while at the same time page caches are actively trying to store the unoptimized page to be served from cache. This means that the unoptimized page could be cached and served to visitors, resulting not only in worse page performance but also in the clients attempting to submit new URL Metrics only to have them rejected by the REST API because the sample has has already been collected.
We do have one mitigation in place to address this problem: when a new URL Metric is stored, we pass along the ID for a post used in The Loop, and then we schedule an action to fire actions like save_post
with that ID. This in turn causes caches to invalidate their caches so that the newly optimized page can be served to users. This was introduced in #1641.
However, this approach may still include additional latency. An alternative approach would be for page caches to wait to store the cached page until it has been optimized. Additionally, as opposed to waiting altogether, it could set the TTL for the page cache to something low like 1 minute.
To achieve this, there could be a new helper function introduced like od_is_url_metric_collection_complete()
. This would be a simple wrapper around OD_URL_Metric_Group_Collection::is_every_group_complete()
, although we should consider whether the OD_URL_Metric_Group_Collection
instance it creates could be reused as opposed to being instantiated multiple times. See #1859 (comment).
This is based on a suggestion from @aaronjorbin.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status