mirror of https://github.com/embarklabs/embark.git
fix(stack/proxy): have proxy.stop() receive callback
This commit is contained in:
parent
d9c8109201
commit
ec134b9307
|
@ -157,14 +157,18 @@ export default class ProxyManager {
|
||||||
this.logger.info(`WS Proxy for node endpoint ${endpoint} listening on ${buildUrl("ws", this.host, this.wsPort, "ws")}`);
|
this.logger.info(`WS Proxy for node endpoint ${endpoint} listening on ${buildUrl("ws", this.host, this.wsPort, "ws")}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private stopProxy() {
|
private stopProxy() {
|
||||||
|
const promises: any[] = [];
|
||||||
if (this.wsProxy) {
|
if (this.wsProxy) {
|
||||||
this.wsProxy.stop();
|
promises.push(new Promise(resolve => this.wsProxy.stop(resolve)));
|
||||||
this.wsProxy = null;
|
this.wsProxy = null;
|
||||||
}
|
}
|
||||||
if (this.httpProxy) {
|
if (this.httpProxy) {
|
||||||
this.httpProxy.stop();
|
promises.push(new Promise(resolve => this.httpProxy.stop(resolve)));
|
||||||
this.httpProxy = null;
|
this.httpProxy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return promises.length ? Promise.all(promises) : Promise.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,11 +343,11 @@ export class Proxy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop(cb) {
|
||||||
if (!this.server) {
|
if (!this.server) {
|
||||||
return;
|
return cb();
|
||||||
}
|
}
|
||||||
this.server.close();
|
this.server.close(cb);
|
||||||
this.server = null;
|
this.server = null;
|
||||||
this.app = null;
|
this.app = null;
|
||||||
this.transactions = {};
|
this.transactions = {};
|
||||||
|
|
Loading…
Reference in New Issue