Skip to content

Commit

Permalink
Check Membership requests should only occur on fresh local state prefs.
Browse files Browse the repository at this point in the history
Currently we initiate the check membership requests when we detect it
is a new UTC Day. We want to reduce the QPS of the check membership
requests by differentiating between a previously set local state pref
and a fresh (unix epoch) pref.

(cherry picked from commit 2140c23)

BUG: 1315391
Change-Id: I92cb96488e07929dae30237def4b5157680b4570
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3581333
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Hirthanan Subenderan <hirthanan@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#993836}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3594453
Auto-Submit: Hirthanan Subenderan <hirthanan@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4951@{#895}
Cr-Branched-From: 27de622-refs/heads/main@{#982481}
  • Loading branch information
Hirthanan Subenderan authored and Chromium LUCI CQ committed Apr 19, 2022
1 parent 7466a35 commit d879e55
Show file tree
Hide file tree
Showing 2 changed files with 489 additions and 75 deletions.
27 changes: 17 additions & 10 deletions ash/components/device_activity/device_activity_client.cc
Expand Up @@ -376,23 +376,33 @@ void DeviceActivityClient::TransitionOutOfIdle(

switch (current_use_case->GetPsmUseCase()) {
case psm_rlwe::RlweUseCase::CROS_FRESNEL_DAILY:
// Check membership continues when the cached local state pref
// is not set. The local state pref may not be set if the device is
// new, powerwashed, recovered, RMA, or the local state was corrupted.
if (base::FeatureList::IsEnabled(
features::kDeviceActiveClientDailyCheckMembership)) {
features::kDeviceActiveClientDailyCheckMembership) &&
(current_use_case->GetLastKnownPingTimestamp() ==
base::Time::UnixEpoch())) {
TransitionToCheckMembershipOprf(current_use_case);
return;
} else {
// During rollout, we perform CheckIn without CheckMembership for
// powerwash, recovery, or RMA devices.
// |TransitionToCheckIn| if the local state pref is set.
TransitionToCheckIn(current_use_case);
return;
}
case psm_rlwe::RlweUseCase::CROS_FRESNEL_MONTHLY:
// Check membership continues when the cached local state pref is not
// set. The local state pref may not be set if the device is
// new, powerwashed, recovered, RMA, or the local state was corrupted.
if (base::FeatureList::IsEnabled(
features::kDeviceActiveClientMonthlyCheckMembership)) {
features::kDeviceActiveClientMonthlyCheckMembership) &&
(current_use_case->GetLastKnownPingTimestamp() ==
base::Time::UnixEpoch())) {
TransitionToCheckMembershipOprf(current_use_case);
return;
}

// |TransitionToCheckIn| if the local state pref is set.
if (base::FeatureList::IsEnabled(
features::kDeviceActiveClientMonthlyCheckIn)) {
// During rollout, we perform CheckIn without CheckMembership for
Expand Down Expand Up @@ -645,10 +655,10 @@ void DeviceActivityClient::OnCheckMembershipQueryDone(

psm_rlwe::PrivateMembershipRlweQueryResponse query_response =
psm_query_response.rlwe_query_response();

auto status_or_response =
current_use_case->GetPsmRlweClient()->ProcessQueryResponse(
query_response);

if (!status_or_response.ok()) {
RecordDurationStateMetric(state_, state_timer_.Elapsed());
TransitionToIdle(current_use_case);
Expand All @@ -659,11 +669,8 @@ void DeviceActivityClient::OnCheckMembershipQueryDone(
// regarding the current PSM ID.
psm_rlwe::RlweMembershipResponses rlwe_membership_responses =
status_or_response.value();
if (rlwe_membership_responses.membership_responses_size() != 1 ||
rlwe_membership_responses.membership_responses(0)
.plaintext_id()
.sensitive_id() !=
current_use_case->GetPsmIdentifier().value().sensitive_id()) {

if (rlwe_membership_responses.membership_responses_size() != 1) {
RecordDurationStateMetric(state_, state_timer_.Elapsed());
TransitionToIdle(current_use_case);
return;
Expand Down

0 comments on commit d879e55

Please sign in to comment.