Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Follow-up to Pocket background fetch #2325

Closed
18 tasks done
dnarcese opened this issue May 23, 2019 · 10 comments
Closed
18 tasks done

Follow-up to Pocket background fetch #2325

dnarcese opened this issue May 23, 2019 · 10 comments
Assignees
Labels
chore Task to improve tooling, do something not product/user facing P1 High impact and/or high frequency size M 3 pts = 2-3 days = 12 - 18 hours

Comments

@dnarcese
Copy link
Contributor

dnarcese commented May 23, 2019

Follow-up tasks to #2223

Vision statement / What / Requirements

The tasks that were not finished in the original PR:

  • Remove remaining old Pocket foreground fetch code

    • Rename PocketEndpoint?
    • Remove PocketRepoCache and comment why it's not necessary (b/c we only content in onStart)
    • Remove other unused code
  • Clean up comments in scheduler

  • Notify team

    • We only update for users who use the app; updates only scheduled if user uses app that day (what implications might product and UX care about?)
    • Users who never background the app (i.e. for whom screensaver is disabled, or constantly use the app) will never get updates
  • Documentation

    • Email + code comments that explains how the fetch works
    • WorkManager edge cases documented in shared docs
  • Automated tests

    • No API key
    • Non en-US locales
    • Failure to hit the server == retry in background job (retry delay should have some randomness)
    • Invalid json from server == just fail
  • Manual testing/understanding

    • Does Sentry catch crashes in PocketWorker? + rm TODO in PocketVideoFetchWorker
    • What happens when exceptions are thrown inside the PocketWorker? + rm TODO in PocketVideoFetchWorker
    • If a user's device is turned off and turned back on before the scheduled time, does WorkManager still run the job at the scheduled time?
  • Expose integration tests for QA - through custom intent flags

Impact

Some unused code needs to be removed and this background fetch functionality needs to be tested.

Acceptance criteria

All the above tasks are completed.

@dnarcese dnarcese added the chore Task to improve tooling, do something not product/user facing label May 23, 2019
@dnarcese dnarcese added the size M 3 pts = 2-3 days = 12 - 18 hours label May 23, 2019
@devinreams devinreams added this to the 2019 Q2 Sprint 5 milestone May 24, 2019
@devinreams devinreams added the P1 High impact and/or high frequency label May 24, 2019
@mcomella mcomella self-assigned this May 24, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 24, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 24, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 24, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 24, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 24, 2019
The code is already available in a-c: it just needs to be exposed and
perhaps refactored a little bit to support being exposed.
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 24, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 25, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 25, 2019
There is more code to be tested so I left TODOs in the test file.
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 25, 2019
mcomella added a commit to mcomella/firefox-tv that referenced this issue May 25, 2019
There is more code to be tested so I left TODOs in the test file.
dnarcese added a commit to mcomella/firefox-tv that referenced this issue May 28, 2019
@nojunpark
Copy link
Contributor

Just my 2 cents:

So this is my understanding of the background fetch works (which could be wrong):

  • Background fetch is scheduled typically between anytime during 3AM and 6AM

  • When the app is started, it checks for the fetched video JSON, and schedules the next fetch time

  • Initially there is a hardcoded video JSON (so there is always something to show on the overlay)

  • Assuming it will always fetch the list of video from pocket server that’s different from what we currently have

  • We don’t have the record of the last successful fetch timestamp

If above is correct, it would be ideal if we have following grey-box tests that does the following, in addition to the usual unit tests. They cover pretty typical scenarios:

Checking whether update actually happens nominally:

  • Opens app, checks the fetch is done, checks the next update schedule value is set.
  • Change the next update schedule to currentTime + 1000ms
  • wait to see whether pocketstore updates and refreshes overlay when reopened

Checking whether pocket updates past the specified time:

  • Opens app, checks the fetch is done, checks the next update schedule value is set.
  • Change the next update schedule to currentTime or past time (assuming this gets noticed by the app)
  • Check whether the pocketstore updates (since the scheduled time is now in the past) and refreshes overlay when reopened

Checking whether app does not crash during network is down, and schedule reattempt

  • Opens app, checks the fetch is done, checks the next update schedule value is set.
  • Disable wifi
  • Change the next update schedule to currentTime + 1000ms
  • wait too see the app does not crash after failed fetch attempt, and check backoff time is properly set

Alternatively, above scenario can be done manually too, but then we need a way for the manual tester to view/edit next update schedule via about:config or so. Also, I think different locale test can be covered manually too. If we go that route, I'll update TestRail with additional test cases.

mcomella added a commit that referenced this issue May 28, 2019
mcomella added a commit that referenced this issue May 28, 2019
mcomella added a commit that referenced this issue May 28, 2019
The code is already available in a-c: it just needs to be exposed and
perhaps refactored a little bit to support being exposed.
dnarcese pushed a commit that referenced this issue May 30, 2019
There is more code to be tested so I left TODOs in the test file.
@mcomella
Copy link
Contributor

mcomella commented Jun 5, 2019

@mcomella Yes! I updated the comment with my results of using throw RuntimeException

Keep in mind we don't get email updates for edits! :)

@dnarcese If that's the case, can you file a follow-up to investigate how we might get Sentry working in WorkManager?

dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 10, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit to dnarcese/firefox-tv that referenced this issue Jun 11, 2019
dnarcese added a commit that referenced this issue Jun 12, 2019
dnarcese added a commit that referenced this issue Jun 12, 2019
dnarcese added a commit that referenced this issue Jun 12, 2019
@dnarcese
Copy link
Contributor Author

Completed in b8b29d.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
chore Task to improve tooling, do something not product/user facing P1 High impact and/or high frequency size M 3 pts = 2-3 days = 12 - 18 hours
Projects
None yet
Development

No branches or pull requests

4 participants