Skip to content

Commit ec134b9

Browse files
committed
fix(stack/proxy): have proxy.stop() receive callback
1 parent d9c8109 commit ec134b9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/stack/proxy/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,18 @@ export default class ProxyManager {
157157
this.logger.info(`WS Proxy for node endpoint ${endpoint} listening on ${buildUrl("ws", this.host, this.wsPort, "ws")}`);
158158
}
159159
}
160+
160161
private stopProxy() {
162+
const promises: any[] = [];
161163
if (this.wsProxy) {
162-
this.wsProxy.stop();
164+
promises.push(new Promise(resolve => this.wsProxy.stop(resolve)));
163165
this.wsProxy = null;
164166
}
165167
if (this.httpProxy) {
166-
this.httpProxy.stop();
168+
promises.push(new Promise(resolve => this.httpProxy.stop(resolve)));
167169
this.httpProxy = null;
168170
}
171+
172+
return promises.length ? Promise.all(promises) : Promise.resolve();
169173
}
170174
}

packages/stack/proxy/src/proxy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ export class Proxy {
343343
});
344344
}
345345

346-
stop() {
346+
stop(cb) {
347347
if (!this.server) {
348-
return;
348+
return cb();
349349
}
350-
this.server.close();
350+
this.server.close(cb);
351351
this.server = null;
352352
this.app = null;
353353
this.transactions = {};

0 commit comments

Comments
 (0)