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

Fix #1106: Addition of Work Manager for uploading logs #1680

Merged
merged 51 commits into from
Sep 4, 2020

Conversation

Sarthak2601
Copy link
Contributor

@Sarthak2601 Sarthak2601 commented Aug 19, 2020

Explanation

Fixes #1106 - Implements work manager for uploading events and exceptions to Firebase in presence of network connection.

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

Copy link
Contributor

@vinitamurthi vinitamurthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can add tests now

private const val OPPIA_EXCEPTION_WORK = "OPPIA_EXCEPTION_WORK_REQUEST"
private const val OPPIA_EVENT_WORK = "OPPIA_EVENT_WORK_REQUEST"

class OppiaLogUploader() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit unsure what the purpose of this class is. This is not an uploader since its not doing any uploading. It looks like its only creating the worker requests right? Can we rename this class accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aah, I named it so because the work requests are after all the ones that will start the process of uploading. Changed it to OppiaLogUploadWorkRequest, is that fine now ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this open, for further communication in future.

@vinitamurthi vinitamurthi removed their assignment Aug 21, 2020
Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant to request changes.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Sarthak2601! PTAL at my comments & reply before I approve. Also, I think you'll need to make Bazel changes and that will require my approval per code owners.

): LogUploadChildWorkerFactory

@Binds
fun bindWorkerFactory(logUploadWorkerFactory: LogUploadWorkerFactory): WorkerFactory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why the factory is needed, but I don't quite understand why we can't inject LogUploadWorkerFactory where we're currently injecting WorkerFactory (though I don't actually see this injected anywhere--are you sure this binding is being used?)

}

@Test
fun testWorker_logException_withoutNetwork_enqueueRequest_verifySuccess() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear: I'm actually suggesting that we verify that we don't enqueue the request if we log with internet connectivity on (since it should just log as normal). Am I maybe misunderstanding why we shouldn't do that?

@BenHenning BenHenning removed their assignment Sep 4, 2020
@Sarthak2601
Copy link
Contributor Author

Sarthak2601 commented Sep 4, 2020

@BenHenning for the code owners, I've added artifacts in Bazel and it's building perfectly. PTAL. Also, I used this article for work manager - dagger integration.

utility/BUILD.bazel Outdated Show resolved Hide resolved
@BenHenning
Copy link
Member

@Sarthak2601 left 1 new comment & replies to most existing threads. PTAL.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock, but submission is conditioned on my comment threads being resolved. @rt4914 & @anandwana001 please verify these.

@BenHenning BenHenning removed their assignment Sep 4, 2020
Sarthak2601 and others added 6 commits September 4, 2020 21:56
be initialized (these tests shouldn't use OppiaApplication anymore).
Includes some fixes for various tests that may have had
flakiness/syncing issues before, and removed one test activity that
wasn't actually used. One test was also ignored because it isn't testing
the correct thing and it fails when the correct assertion is added, so
follow-up work is needed.
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@Sarthak2601 Sarthak2601 merged commit 2d14066 into develop Sep 4, 2020
@Sarthak2601 Sarthak2601 deleted the oppia-work-manager branch September 4, 2020 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Addition of Work Manager [GSoC'20][Milestone 3]
5 participants