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

Adds delays for suggestion api #4372

Merged
merged 1 commit into from
Jan 22, 2020
Merged

Adds delays for suggestion api #4372

merged 1 commit into from
Jan 22, 2020

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Jan 14, 2020

Resolves brave/brave-browser#7709
Resolves brave/brave-browser#6940

Submitter Checklist:

Test Plan:

Plan 1:

  • enable rewards (with short contribution)
  • claim promotion
  • add couple of monthly contributions
  • add couple of verified publishers to ac table
  • wait for contribution to be triggered
  • make sure that everything goes through and that reports and balance is reflected correctly

Plan 2:

  • enable rewards
  • claim promotion
  • do one time tips
  • make sure that everything is ok (summary and balance)

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

Copy link
Collaborator

@kylehickinson kylehickinson left a comment

Choose a reason for hiding this comment

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

iOS specifics look good.

@NejcZdovc Are these all are going to be removed with DB migration? I assume we can't do much to implement them in its current state?

Comment on lines +97 to +98
- (void)updateContributionInfoStepAndCount:(const std::string&)contribution_id step:(const ledger::ContributionStep)step retry_count:(const int32_t)retry_count callback:(ledger::ResultCallback)callback;
- (void)updateContributionInfoContributedAmount:(const std::string&)contribution_id publisher_key:(const std::string&)publisher_key callback:(ledger::ResultCallback)callback;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd say we should stick with Obj-C naming convention here (i.e. retry_countretryCount), however, if these methods are just going to be deleted with DB migration at a later date its fine to keep them how they are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup all of it will be removed with db migration

@@ -157,8 +157,12 @@ bool DatabaseContributionInfoPublishers::InsertOrUpdate(
return false;
}

const std::string query = base::StringPrintf(
"INSERT OR REPLACE INTO %s "
const std::string query_delete = base::StringPrintf(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

temp fix as we can't do db changes in 1.3. Issue that will resolve it in a right way brave/brave-browser#7838

@NejcZdovc NejcZdovc added CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-linux CI/skip-macos-x64 Do not run CI builds for macOS x64 labels Jan 21, 2020
@NejcZdovc
Copy link
Contributor Author

CI failed on windows for test-scripts (https://ci.brave.com/job/brave-browser-build-pr/job/ac-delay/2/execution/node/225/log/), everything else is ok. Restarting windows

@NejcZdovc NejcZdovc requested a review from a team January 21, 2020 19:49
Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM++

@NejcZdovc NejcZdovc removed CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-linux labels Jan 22, 2020
Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

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

++

@bsclifton
Copy link
Member

Merging as this is all approved and CI is passing 😄

@bsclifton bsclifton merged commit acbcf4f into master Jan 22, 2020
@bsclifton bsclifton deleted the ac-delay branch January 22, 2020 20:31
@LaurenWags
Copy link
Member

Verified using

Brave 1.5.53 Chromium: 79.0.3945.130 (Official Build) nightly (64-bit)
Revision e22de67c28798d98833a7137c0e22876237fc40a-refs/branch-heads/3945@{#1047}
OS macOS Version 10.14.6 (Build 18G103)
  1. Verified Test Plan from Adds delays for suggestion api #4372
    • Test plan 1 worked as expected. Note, AC processed slowly and the entire budget amount (in my case 10 BAT) was not removed from my wallet all at once. As the AC was processed the wallet balance went down 10.5 --> 9.3 --> 8 --> 7.5 --> etc until finally the entire amount was deducted from my balance. At this point, then Auto-Contribute was displayed on brave://rewards and panel wallet summary screens.

4372-testplan1-ss1

4372-testplan1-ss2

4372-testplan1-ss3

  • Test plan 2 worked as expected

4372-testplan2-ss1

4372-testplan2-ss2

  1. Verified STR from entire a-c not going through due to missing delays brave-browser#7709
    • Case 1 worked as expected

7709-case1-ss1

7709-case1-ss2

  • Case 2 is the same as test plan 1 from PR description, worked as expected.
  1. Unable to verify STR from entire a-c not going through due to missing delays brave-browser#7709 (comment) - due to caching problem on staging balance server (see thread in #ledger)

Additionally, since PR test plan used UGP grants (virtual grants) only as a means of funding the wallet for testing, I ran the following additional scenarios:
A. Using a self-funded anon wallet did:

  • 1 time tip
  • recurring tip
  • auto contribute
    Then, for each of the above,
  • verified it was recorded on brave://rewards
  • verified it was recorded on the panel
  • verified wallet balance decreased as expected
  • verified on browser relaunch, wallet balance was not reduced
  • contribution_info and contribution_info_publishers tables were populated as expected

B. Using a KYC'd user wallet did:

  • 1 time tip
  • recurring tip
  • auto contribute
    Then, for each of the above,
  • verified it was recorded on brave://rewards
  • verified it was recorded on the panel
  • verified wallet balance decreased as expected
  • verified on browser relaunch, wallet balance was not reduced
  • contribution_info and contribution_info_publishers tables were populated as expected

bsclifton added a commit that referenced this pull request Jan 27, 2020
Adds delays for suggestion api
bsclifton added a commit that referenced this pull request Jan 27, 2020
Adds delays for suggestion api
tmancey pushed a commit that referenced this pull request Jan 27, 2020
Adds delays for suggestion api
bsclifton added a commit that referenced this pull request Jan 28, 2020
Adds delays for suggestion api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

entire a-c not going through due to missing delays Retry logic for unblided tokens contribution
7 participants