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

Fixes ads service will crash if a user previously had ads history and triggers OnUnIdle before Brave ads are initialized #3977

Merged
merged 1 commit into from
Nov 12, 2019

Conversation

tmancey
Copy link
Collaborator

@tmancey tmancey commented Nov 12, 2019

Fixes brave/brave-browser#6880

Submitter Checklist:

Test Plan:

See brave/brave-browser#6880 for steps

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
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM

@tmancey tmancey 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 Nov 12, 2019
@tmancey
Copy link
Collaborator Author

tmancey commented Nov 12, 2019

Windows failed CI so restarting Windows build

@tmancey tmancey removed 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 Nov 12, 2019
@@ -231,7 +231,7 @@ bool AdsImpl::IsInitialized() {
void AdsImpl::Shutdown(
ShutdownCallback callback) {
if (!is_initialized_) {
BLOG(WARNING) << "Failed to shutdown ads as not initialized";
BLOG(WARNING) << "Shutdown failed as not initialized";
Copy link
Contributor

Choose a reason for hiding this comment

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

Better as (INFO)? It's fair to say you can't shut something down if it's not initialised, so really this is just diagnostic at this point to say something called it prematurely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Our logs are quite busy as is, so wanted to reduce noise. When diagnosing issues we use a higher verbosity.

@@ -342,6 +344,10 @@ void AdsImpl::OnUnIdle() {

BLOG(INFO) << "Browser state changed to unidle";

if (!IsInitialized()) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

BLOG here perhaps? Or superfluous?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, adding now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

… triggers OnUnIdle before Brave ads are initialized
@tmancey tmancey merged commit 3d4c246 into master Nov 12, 2019
@tmancey tmancey deleted the issues/6880 branch November 12, 2019 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants