Skip to content

Commit

Permalink
fix(server): clear web server close timeout on clean close
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Apr 18, 2014
1 parent 074bc26 commit 34123fe
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,15 @@ var start = function(injector, config, launcher, globalEmitter, preprocess, file
};

globalEmitter.emitAsync('exit').then(function() {
// shutdown the server...
webServer.close(removeAllListeners);

// ...but don't wait forever on webServer.close() because
// don't wait forever on webServer.close() because
// pending client connections prevent it from closing.
setTimeout(removeAllListeners, webServerCloseTimeout);
var closeTimeout = setTimeout(removeAllListeners, webServerCloseTimeout);

// shutdown the server...
webServer.close(function() {
clearTimeout(closeTimeout);
removeAllListeners();
});
});
};

Expand Down

0 comments on commit 34123fe

Please sign in to comment.