diff --git a/packager/react-packager/src/SocketInterface/SocketServer.js b/packager/react-packager/src/SocketInterface/SocketServer.js index 19b4b29cf..8c32db408 100644 --- a/packager/react-packager/src/SocketInterface/SocketServer.js +++ b/packager/react-packager/src/SocketInterface/SocketServer.js @@ -114,7 +114,6 @@ class SocketServer { _reply(sock, id, type, data) { debug('request finished', type); - this._jobs--; data = toJSON(data); sock.write(bser.dumpToBuffer({ @@ -122,6 +121,11 @@ class SocketServer { type, data, })); + + // Debounce the kill timer to make sure all the bytes are sent through + // the socket and the client has time to fully finish and disconnect. + this._dieEventually(); + this._jobs--; } _dieEventually(delay = MAX_IDLE_TIME) {