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

Feature/cancel background task when disable #302

Merged
merged 4 commits into from
Jan 13, 2017

Conversation

jaeklim
Copy link
Contributor

@jaeklim jaeklim commented Jan 13, 2017

No description provided.

@jaeklim jaeklim requested a review from guperrot January 13, 2017 18:10
@msftclas
Copy link

Hi @jaelim-ms, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Jae Lim). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

@codecov-io
Copy link

codecov-io commented Jan 13, 2017

Current coverage is 100% (diff: 100%)

Merging #302 into develop will not change coverage

@@           develop   #302   diff @@
=====================================
  Files           60     60          
  Lines         2704   2711     +7   
  Methods          0      0          
  Messages         0      0          
  Branches       493    494     +1   
=====================================
+ Hits          2704   2711     +7   
  Misses           0      0          
  Partials         0      0          

Powered by Codecov. Last update f2baab3...d961456

Copy link
Member

@guperrot guperrot left a comment

Choose a reason for hiding this comment

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

Minor style issues

Crashes.getInstance().onChannelReady(sContext, channel);
assertNotNull(Crashes.getLastSessionCrashReport());

/* Try to get last session crash after Crashes service completed processing. */
waitForCrashesHandlerTasksToComplete();
// waitForCrashesHandlerTasksToComplete();
Copy link
Member

Choose a reason for hiding this comment

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

remove then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Forgot to remove the line after testing.


@Override
public void run() {
/* Call callbacks for getInstanceLastSessionCrashReport(ResultCallback) . */
Copy link
Member

Choose a reason for hiding this comment

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

new line should go before comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

errorLogReport.log.setErrorAttachment(attachment);
mChannel.enqueue(errorLogReport.log, ERROR_GROUP);

/* Clean up an error log file and map entry. */
Copy link
Member

Choose a reason for hiding this comment

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

tab instead of whitespaces apparently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is very weird. My AS configuration should use spaces instead of tabs. It is not possible!!


/* Processed crash report for the last session. */
if (isInstanceEnabled())
mHandler.getLooper().quit();
Copy link
Member

Choose a reason for hiding this comment

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

This can't work if the SDK is re-enabled later, I don't see code that re-creates a new HandlerThread the next time the SDK is enabled. The code that creates the HandlerThread should be moved to the init while enabled method I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. Basically all file related operations should be just one time job so it doesn't have any scenarios that require this handler by disable/enable.

Copy link
Member

@guperrot guperrot Jan 13, 2017

Choose a reason for hiding this comment

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

If the SDK is disabled while processing pending reports, it must resume when enabled again, that was the case before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are deleting all logs when the service gets disabled. There is nothing we need to take care of.

Copy link
Member

Choose a reason for hiding this comment

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

But we still try to post runnables to Handler no if we reenable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. It goes through initialization steps but it won't post any runnables to that handler because the service already deleted all pending files when it disabled.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, but later when we move listFiles and delete calls to worker thread too we will need to do this modification as well.

@guperrot guperrot merged commit f504ef8 into develop Jan 13, 2017
@guperrot guperrot deleted the feature/cancel-background-task-when-disable branch January 13, 2017 23:50
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.

None yet

4 participants