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

RDV: Fix the performance issue on AT sites #41248

Merged
merged 7 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Fixed a performance issue on AT that was reproducing only for a12s.


Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,24 @@ function wpcom_is_duplicate_views_experiment_enabled() {

$data = json_decode( wp_remote_retrieve_body( $response ), true );

if ( isset( $data['variations'] ) && isset( $data['variations'][ $experiment_name ] ) ) {
if ( isset( $data['variations'][ $experiment_name ] ) ) {
$variation = $data['variations'][ $experiment_name ];
update_user_option( get_current_user_id(), $option_name, $variation, true );

$is_enabled = 'treatment' === $variation;
return $is_enabled;
} elseif ( isset( $data['variations'] ) ) {
/**
* If the variations array is set but the variation value is null chances are this is an a11n (since ExPlat returns null for a12s).
*
* We want to set the treatment for all a12s.
*/
update_user_option( get_current_user_id(), $option_name, 'treatment', true );
$is_enabled = true;
} else {
$is_enabled = false;
return $is_enabled;
}

return $is_enabled;
}

/**
Expand Down
Loading