Skip to content

Storage lock TTL can be reduced or eliminated for admin users #1829

@westonruter

Description

@westonruter

Feature Description

As of #1788, URL Metric collection is no longer disabled for administrators and URL Metrics for administrators will now apply to page loads for non-administrators since URL Metrics are now no longer varied by authentication state. However, the storage lock persists for admin users. Nevertheless, this is not necessary since admin users are expected to do database writes. So it seems that admin users should have the default storage lock of 1 minute reduced to zero. This will allow an admin user to quickly gather URL Metrics for their site manually just by browsing around.

This can currently be achieved with the following plugin code:

add_filter( 'od_metrics_storage_lock_ttl', static function ( int $ttl ): int {
    return current_user_can( 'customize' ) ? 0 : $ttl;
} );

But this should be made the default when the user has the customize capability.

This will also be relevant to #1311 in that there won't be a need to load pages without authentication while at the same time ensuring the storage lock is disabled. (That being said, it would still be preferable to bulk/batch gather URL Metrics while simulating a logged-out user since the analyzed page would more likely be reflective of what a regular visitor would see.)

Metadata

Metadata

Assignees

Labels

Projects

Status

Done 😃

Relationships

None yet

Development

No branches or pull requests

Issue actions