Skip to content

fix(livesync): dispose when stopping livesync#3376

Closed
Mitko-Kerezov wants to merge 1 commit into
masterfrom
kerezov/dispose-stop-livesync
Closed

fix(livesync): dispose when stopping livesync#3376
Mitko-Kerezov wants to merge 1 commit into
masterfrom
kerezov/dispose-stop-livesync

Conversation

@Mitko-Kerezov
Copy link
Copy Markdown
Contributor

Whenever LiveSync fails to launch for the first time CLI doesn't break process execution because there are hanging child processes (ios-device detection, analytics).

If this is the case, force dispose those resources.

Fixes: #3375

Ping @rosen-vladimirov

@Mitko-Kerezov Mitko-Kerezov added this to the 4.0.0 milestone Feb 19, 2018
@Mitko-Kerezov Mitko-Kerezov self-assigned this Feb 19, 2018
@Mitko-Kerezov
Copy link
Copy Markdown
Contributor Author

run ci

public dispose(): void {
if (this.brokerProcess && this.shouldDisposeInstance) {
public dispose(disposeOptions?: IForceOption): void {
if ((disposeOptions && disposeOptions.force) || (this.brokerProcess && this.shouldDisposeInstance)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In case you do not have a brokerProcess, but disposeOptions.force is true, you'll have an error on the next line.

@Mitko-Kerezov Mitko-Kerezov force-pushed the kerezov/dispose-stop-livesync branch from c6f2970 to 5a9a4cf Compare February 21, 2018 07:26
@dtopuzov
Copy link
Copy Markdown
Contributor

run ci

// as in case we execute nativescript-dev-typescript's before-prepare hook again in the same process, it MUST transpile the files.
this.$usbLiveSyncService.isInitialized = false;
// After stopping LiveSync we need to dispose of everything in order for the process to end and release all resources
this.$injector.dispose({ force: true });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this will cause issues with device detection in Sidekick where we have a long living process. We shouldn't dispose the injector in this case, as this will kill iOS devices detection as well. We should find a better general solution for this case.

@Mitko-Kerezov
Copy link
Copy Markdown
Contributor Author

Closing this in regards to the issues @rosen-vladimirov pointed out, will rethink the approach an open a new PR

@rosen-vladimirov rosen-vladimirov deleted the kerezov/dispose-stop-livesync branch July 13, 2018 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants