Skip to content

Commit 3bc148a

Browse files
committed
Fix server hang when lr is disabled
1 parent 30bb2b2 commit 3bc148a

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

src/infer/params.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* @flow */
22

3-
const t = require('babel-types');
4-
const generate = require('babel-generator').default;
5-
const _ = require('lodash');
6-
const findTarget = require('./finders').findTarget;
7-
const flowDoctrine = require('../flow_doctrine');
3+
import * as t from 'babel-types';
4+
import generate from 'babel-generator';
5+
import _ from 'lodash';
6+
import finders from './finders';
7+
import flowDoctrine from '../flow_doctrine';
88

99
/**
1010
* Infers param tags by reading function parameter names
@@ -13,7 +13,7 @@ const flowDoctrine = require('../flow_doctrine');
1313
* @returns {Object} comment with parameters
1414
*/
1515
function inferParams(comment: Comment) {
16-
var path = findTarget(comment.context.ast);
16+
var path = finders.findTarget(comment.context.ast);
1717

1818
// In case of `/** */ var x = function () {}` findTarget returns
1919
// the declarator.

src/serve/server.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,13 @@ class Server extends EventEmitter {
121121
* Shut down the server's HTTP & LiveReload endpoints. This method
122122
* can be called multiple times.
123123
*/
124-
return new Promise(resolve => {
125-
// idempotent
126-
if (!this._lr) {
127-
return resolve(this);
128-
}
129-
130-
this._http.close(() => {
131-
this._lr.close();
132-
delete this._http;
133-
delete this._lr;
134-
resolve(this);
135-
});
124+
return Promise.all([
125+
this._http && this._http.close(),
126+
this._lr && this._lr.close()
127+
]).then(() => {
128+
delete this._http;
129+
delete this._lr;
130+
return this;
136131
});
137132
}
138133
}

0 commit comments

Comments
 (0)