|
|
Chromium Code Reviews
DescriptionMake the site engagement service more robust to clock changes and time inconsistencies.
This CL adjusts the site engagement service's logic for rebasing last
engagement times when no engagement has been earned for some time.
This code was prone to errors when users changed their clocks, where
last engagement times could be moved into the future or into the past
based on a clock change. This has only recently become an issue because
the rebasing codepath now triggers if no engagement is earned for ~9
hours, as opposed to three weeks.
The code was also brittle if the overall last engagement time (a lossy
pref) became out of sync with any single engagement score's last
engagement time (a lossy content setting). It is theoretically possible
that the content setting would be written to prefs, but the overall last
engagement time would not due to the prefs system buffering the lossy
write and then failing to complete it before browser shutdown.
This CL changes the rebase logic to also sanely handle unexpected times
caused by changing clocks or pref writing race conditions. Time rebasing
now occurs when the last engagement time is detected to be in the future
as well as in the past. Regression tests are added to ensure the correct
behaviour.
BUG=654560
Committed: https://crrev.com/ed64b2a6aaeb060283ca5583abc1583a879b1ce1
Cr-Commit-Position: refs/heads/master@{#426696}
Patch Set 1 #
Total comments: 1
Patch Set 2 : Handle last engagement in the future as well #Patch Set 3 : Cap last_engagement_time at now #
Total comments: 2
Patch Set 4 : Address nit #
Messages
Total messages: 30 (22 generated)
The CQ bit was checked by dominickn@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Regression tests are added to ensure the correct behaviour. BUG=654560 ========== to ========== Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Regression tests are added to ensure the correct behaviour. BUG=654560 ==========
dominickn@chromium.org changed reviewers: + benwells@chromium.org
PTAL, thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Exceeded global retry quota
https://codereview.chromium.org/2427343002/diff/1/chrome/browser/engagement/s... File chrome/browser/engagement/site_engagement_service_unittest.cc (right): https://codereview.chromium.org/2427343002/diff/1/chrome/browser/engagement/s... chrome/browser/engagement/site_engagement_service_unittest.cc:1524: clock->SetNow(before_stale_period); What would happen if CleanupEngagementScores(true) was called now? From my understanding of the code there is still a DCHECK that would fire, is that right?
Description was changed from ========== Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Regression tests are added to ensure the correct behaviour. BUG=654560 ========== to ========== Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Time rebasing now occurs when the last engagement time is detected to be in the future as well as in the past. Regression tests are added to ensure the correct behaviour. BUG=654560 ==========
The CQ bit was checked by dominickn@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
PTAL, thanks! The code now allows CleanupEngagementScores to run if last_engagement_time is in the future, and it should sanely handle that circumstance. I've modified the test to ensure that a situation with a score in the future and one in the past works as expected.
The CQ bit was checked by dominickn@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm https://codereview.chromium.org/2427343002/diff/40001/chrome/browser/engageme... File chrome/browser/engagement/site_engagement_service.cc (right): https://codereview.chromium.org/2427343002/diff/40001/chrome/browser/engageme... chrome/browser/engagement/site_engagement_service.cc:307: DCHECK(!update_last_engagement_time || ((last_engagement_time >= now) || Nit: So complicated. Can you remove some brackets, i.e. just make this A || B || (C && D), instead of A || ((B) || (C && D))
The CQ bit was checked by dominickn@chromium.org to run a CQ dry run
Thanks! https://codereview.chromium.org/2427343002/diff/40001/chrome/browser/engageme... File chrome/browser/engagement/site_engagement_service.cc (right): https://codereview.chromium.org/2427343002/diff/40001/chrome/browser/engageme... chrome/browser/engagement/site_engagement_service.cc:307: DCHECK(!update_last_engagement_time || ((last_engagement_time >= now) || On 2016/10/20 07:14:43, benwells (slow) wrote: > Nit: So complicated. Can you remove some brackets, i.e. just make this > > A || B || (C && D), > instead of > A || ((B) || (C && D)) Done.
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by dominickn@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from benwells@chromium.org Link to the patchset: https://codereview.chromium.org/2427343002/#ps60001 (title: "Address nit")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Time rebasing now occurs when the last engagement time is detected to be in the future as well as in the past. Regression tests are added to ensure the correct behaviour. BUG=654560 ========== to ========== Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Time rebasing now occurs when the last engagement time is detected to be in the future as well as in the past. Regression tests are added to ensure the correct behaviour. BUG=654560 Committed: https://crrev.com/ed64b2a6aaeb060283ca5583abc1583a879b1ce1 Cr-Commit-Position: refs/heads/master@{#426696} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/ed64b2a6aaeb060283ca5583abc1583a879b1ce1 Cr-Commit-Position: refs/heads/master@{#426696} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
