-
Notifications
You must be signed in to change notification settings - Fork 143
Implement garbage collection for URL metrics posts #895
Description
Feature Description
In the Image Loading Optimization module (see #869), detection logic may run when a visitor lands on a page to collect metrics for that URL, namely which element is LCP and which images were in the initial viewport. This information is then sent to a REST API endpoint and is then stored in an ilo_url_metrics post. Over time, URL metrics will be updated in this post as more visitors land on the page. However, a post gets deleted and the URL for which an ilo_url_metrics post was created, then at present the ilo_url_metrics will persist indefinitely. There should be a cron job that does garbage collection of these posts ilo_url_metrics when they are excessively stale. For example, if the post_modified_gmt for a given post is over a month old, then the post could be deleted.
🆕 This should also involve implementing an uninstall.php which deletes all instances of the custom post type at uninstallation.