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

Activation of plugin that registers a new tag visitor should automatically make URL Metrics stale #1424

Closed
westonruter opened this issue Jul 31, 2024 · 1 comment · Fixed by #1705
Labels
Needs Dev Anything that requires development (e.g. a pull request) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@westonruter
Copy link
Member

When activating a plugin that registers a new tag visitor for Optimization Detective, this should automatically result in all existing URL Metrics to be considered stale. This is so that new URL Metrics can be gathered which take into account the new tag visitor(s). Additionally, each tag visitor should perhaps taken an optional version identifier which can also be used to invalidate cached URL Metrics when the version is bumped. When a URL Metric is stored, there should be a new field that contains the "ETag" of sorts. This ETag would consist of a list of all of the tag visitors' IDs and their versions. For example:

image-prioritizer-img:1.0,embed-optimizer:1.1,auto-sizes:0.1

At runtime if the generated string for the current environment does not match this field in the URL Metric, then it would be the same as if the URL Metric's timestamp is old enough that it is considered stale here:

$current_time = microtime( true );
foreach ( $this->url_metrics as $url_metric ) {
if ( $current_time > $url_metric->get_timestamp() + $this->freshness_ttl ) {
return false;
}
}

Related to this is #1419 which proposes that tag visitors be allowed to declare other tag visitors as dependencies. In this way, OD_Tag_Visitor_Registery is increasingly starting to look like WP_Scripts or WP_Script_Modules.

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature Needs Dev Anything that requires development (e.g. a pull request) [Plugin] Optimization Detective Issues for the Optimization Detective plugin labels Jul 31, 2024
@westonruter westonruter moved this to Definition ✏️ in WP Performance 2024 Jul 31, 2024
@westonruter westonruter moved this from Definition ✏️ to Not Started/Backlog 📆 in WP Performance 2024 Jul 31, 2024
@westonruter
Copy link
Member Author

This is closely related to #1466 where the registered tag visitors should be considered one of the bits of internal page state that comprise the "ETag" for a URL Metric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Anything that requires development (e.g. a pull request) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature
Projects
Status: Done 😃
Development

Successfully merging a pull request may close this issue.

1 participant