Skip to content

Commit 851daf8

Browse files
author
Tsvetan Raikov
committed
Fixed: Livesync both Android and iOS at the same time, only android updates
1 parent 3a7d7fc commit 851daf8

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

lib/npm-installation-manager.ts

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as path from "path";
22
import * as semver from "semver";
33
import * as npm from "npm";
44
import * as constants from "./constants";
5+
import {sleep} from "../lib/common/helpers";
56

67
export class NpmInstallationManager implements INpmInstallationManager {
78
private static NPM_LOAD_FAILED = "Failed to retrieve data from npm. Please try again a little bit later.";
@@ -106,6 +107,11 @@ export class NpmInstallationManager implements INpmInstallationManager {
106107

107108
public install(packageName: string, opts?: INpmInstallOptions): IFuture<string> {
108109
return (() => {
110+
111+
while(this.$lockfile.check().wait()) {
112+
sleep(10);
113+
}
114+
109115
this.$lockfile.lock().wait();
110116

111117
try {

lib/services/livesync/android-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as path from "path";
77
import * as net from "net";
88

99
class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<Mobile.IAndroidDevice> implements IPlatformLiveSyncService {
10-
private static BACKEND_PORT = 18181;
10+
private static BACKEND_PORT = 18182;
1111

1212
constructor(_device: Mobile.IDevice,
1313
private $fs: IFileSystem,

lib/tools/broccoli/builder.ts

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as shelljs from "shelljs";
55
import Future = require("fibers/future");
66
import * as destCopyLib from "./node-modules-dest-copy";
77
import * as fiberBootstrap from "../../common/fiber-bootstrap";
8+
import {sleep} from "../../../lib/common/helpers";
89

910
let glob = require("glob");
1011

@@ -34,6 +35,11 @@ export class Builder implements IBroccoliBuilder {
3435
stat: true
3536
}, (er: Error, files: string[]) => {
3637
fiberBootstrap.run(() => {
38+
39+
while(this.$lockfile.check().wait()) {
40+
sleep(10);
41+
}
42+
3743
this.$lockfile.lock().wait();
3844
if (er) {
3945
if (!future.isResolved()) {

test/stubs.ts

+5
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ export class HooksServiceStub implements IHooksService {
410410
}
411411

412412
export class LockFile {
413+
414+
check(): IFuture<boolean> {
415+
return (() => { return false; }).future<boolean>()();
416+
}
417+
413418
lock(): IFuture<void> {
414419
return (() => {}).future<void>()();
415420
}

0 commit comments

Comments
 (0)