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

Promotions are fetched too often #9513

Closed
NejcZdovc opened this issue Apr 28, 2020 · 2 comments · Fixed by brave/brave-core#5760
Closed

Promotions are fetched too often #9513

NejcZdovc opened this issue Apr 28, 2020 · 2 comments · Fixed by brave/brave-core#5760

Comments

@NejcZdovc
Copy link
Contributor

NejcZdovc commented Apr 28, 2020

We should have some cacheing in this area, so that we don't pull every time that you open a panel for example. We should store last fetch in preferences (last_fetch.promotion) and then when we get request for promotion fetch we check that preference and if's not older then 10min just return what we have in db. We also need to allow for this check to be removed if you pass is_testing set

@LaurenWags
Copy link
Member

LaurenWags commented Jul 20, 2020

Verified passed with

Brave | 1.12.94 Chromium: 84.0.4147.89 (Official Build) dev (64-bit)
-- | --
Revision | 19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147@{#852}
OS | macOS Version 10.14.6 (Build 18G3020)
  • Verified test plan from Retrieve promotions from db when fetched recently brave-core#5760
  • Verified on staging env with the following flags --args --enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=6 --brave-ads-staging --rewards=staging=true --v=1
  • Confirmed after claiming the grant, there were no lines in the terminal like [3346:13827:0720/153245.371484:VERBOSE1:network_delegate.cc(32)] NetworkDelegate::NotifyBeforeURLRequest: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=2e39e07b-74ea-4f54-bd62-2828bb09d142&platform=osx until after >10 minutes had passed, then opening the panel triggered another fetch.

Verification passed on


Brave | 1.12.99 Chromium: 84.0.4147.89 (Official Build) dev (64-bit)
-- | --
Revision | 19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147@{#852}
OS | Windows 10 OS Version 1903 (Build 18362.959)

  • Verified test plan from Retrieve promotions from db when fetched recently brave-core#5760
  • Verified on staging env with the following flags --args --enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=6 --brave-ads-staging --rewards=staging=true --v=1
[18352:5112:0723/202536.446:VERBOSE1:network_delegate.cc(32)] NetworkDelegate::NotifyBeforeURLRequest: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=075fe099-961c-4435-9fb9-dc9910d65fb9&platform=windows
  • Confirmed after claiming the grant, there were no lines in the terminal like

Verification passed on

Brave 1.12.102 Chromium: 84.0.4147.89 (Official Build) dev (64-bit)
Revision 19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147@{#852}
OS Ubuntu 18.04 LTS
  • Verified test plan from Retrieve promotions from db when fetched recently brave-core#5760
  • Verified on staging env with the following flags --args --enable-logging=stderr --vmodule="*/bat-native-ledger/*"=6,"*/brave_rewards/*"=6,"*/bat-native-ads/*"=6,"*/bat-native-confirmations/*"=6,"*/brave_ads/*"=6 --brave-ads-staging --rewards=staging=true --v=1
  • Confirmed after claiming the grant, there were no lines in the terminal like [4542:4550:0727/202256.933719:VERBOSE1:network_delegate.cc(32)] NetworkDelegate::NotifyBeforeURLRequest: https://grant.rewards.bravesoftware.com/v1/promotions?migrate=true&paymentId=90bfb7db-0f74-4752-bbad-326b2aa1dcc7&platform=linux until after >10 minutes had passed, then opening the panel triggered another fetch.

@rebron rebron changed the title Promotions are fetch too often Promotions are fetched too often Jul 21, 2020
@emerick emerick added OS/Android Fixes related to Android browser functionality OS/Desktop OS/iOS Fixes related to iOS browser functionality labels Aug 7, 2020
@srirambv
Copy link
Contributor

Verification passed on OnePlus 6T with Android 10 running 1.12.112 x64 build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants