|
|
Created:
4 years, 2 months ago by Marc Treib Modified:
4 years, 2 months ago CC:
chromium-reviews, ntp-dev+reviews_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Description[NTP Snippets] Add a bit of 'flex' to the background fetching intervals
That achieves the following:
- It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it.
- It gives the scheduler a bit of room to optimize for battery life.
BUG=646842
Committed: https://crrev.com/df864545989e5d99922d2ba88f94e5170aa0d833
Cr-Commit-Position: refs/heads/master@{#421175}
Patch Set 1 #
Total comments: 5
Patch Set 2 : bauerb review #
Depends on Patchset: Messages
Total messages: 21 (12 generated)
treib@chromium.org changed reviewers: + jkrcal@chromium.org
...and another (small) one. This should be the last in the series! https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java (right): https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java:106: long flexSeconds = (long) (periodSeconds * 0.2); The factors are a bit arbitrary, but IMO the exact values don't really matter - WDYT?
lgtm (the comment below is for the future) https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java (right): https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java:106: long flexSeconds = (long) (periodSeconds * 0.2); On 2016/09/23 18:16:50, Marc Treib wrote: > The factors are a bit arbitrary, but IMO the exact values don't really matter - > WDYT? This looks okay. I am not happy with the overall thing, though, we achieve through the API now. What I would like to have: a) Wait for the period (say, 0.9 * period) b) Try to find an opportune time on wifi to fetch (say, in a window of 0.2*period, could be even larger if we have good data that Android is not always pushing it to the far end) c) If it fails, try to fetch as soon as you get wifi connectivity (and Android thinks it is a good idea at the given moment). d) Only if you do not have wi-fi in the whole time up to the scheduled fallback, fetch over cellular. Definitely beyond the scope of this CL, anyway: - In the current strategy, I miss c). Does it make sense to you? - I would like to get an UMA histogram reporting the difference of the period and the actual fetching. (Maybe two histograms - one for fetching earlier than period, the other for fetching later then period to make sure the values are always positive.)
https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java (right): https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java:106: long flexSeconds = (long) (periodSeconds * 0.2); On 2016/09/26 16:08:18, jkrcal wrote: > On 2016/09/23 18:16:50, Marc Treib wrote: > > The factors are a bit arbitrary, but IMO the exact values don't really matter > - > > WDYT? > > This looks okay. I am not happy with the overall thing, though, we achieve > through the API now. What I would like to have: > a) Wait for the period (say, 0.9 * period) > b) Try to find an opportune time on wifi to fetch (say, in a window of > 0.2*period, could be even larger if we have good data that Android is not always > pushing it to the far end) > c) If it fails, try to fetch as soon as you get wifi connectivity (and Android > thinks it is a good idea at the given moment). > d) Only if you do not have wi-fi in the whole time up to the scheduled > fallback, fetch over cellular. > > Definitely beyond the scope of this CL, anyway: > - In the current strategy, I miss c). Does it make sense to you? > - I would like to get an UMA histogram reporting the difference of the period > and the actual fetching. (Maybe two histograms - one for fetching earlier than > period, the other for fetching later then period to make sure the values are > always positive.) Re c): That's what the API seems to do in practice anyway (at least without flex - haven't tested it with flex). Re UMA: Yes, something like that is probably a good idea. For another CL... :)
Description was changed from ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals BUG=646842 ========== to ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 ==========
Description was changed from ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 ========== to ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 ==========
treib@chromium.org changed reviewers: + bauerb@chromium.org
+bauerb for OWNERS approval. PTAL!
lgtm https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java (right): https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java:105: long effectivePeriodSeconds = (long) (periodSeconds * 1.1); Maybe extract these parameters to constants?
https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java (right): https://codereview.chromium.org/2366813003/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java:105: long effectivePeriodSeconds = (long) (periodSeconds * 1.1); On 2016/09/27 09:41:58, Bernhard Bauer wrote: > Maybe extract these parameters to constants? Since they're essentially the same constant, I've made one constant: FLEX_FACTOR = 0.1
The CQ bit was checked by treib@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.
The CQ bit was checked by treib@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from bauerb@chromium.org, jkrcal@chromium.org Link to the patchset: https://codereview.chromium.org/2366813003/#ps20001 (title: "bauerb review")
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.
Description was changed from ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 ========== to ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001)
Message was sent while issue was closed.
Description was changed from ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 ========== to ========== [NTP Snippets] Add a bit of 'flex' to the background fetching intervals That achieves the following: - It makes sure the task doesn't run (significantly) before its initial period has elapsed. In practice, the scheduler seems to behave like that anyway, but it doesn't guarantee that, so we shouldn't rely on it. - It gives the scheduler a bit of room to optimize for battery life. BUG=646842 Committed: https://crrev.com/df864545989e5d99922d2ba88f94e5170aa0d833 Cr-Commit-Position: refs/heads/master@{#421175} ==========
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/df864545989e5d99922d2ba88f94e5170aa0d833 Cr-Commit-Position: refs/heads/master@{#421175} |