Comparing version
@@ -14,3 +14,3 @@ "use strict"; | ||
var _httpClose = _interopRequireDefault(require("http-close")); | ||
var _httpTerminator = require("http-terminator"); | ||
@@ -59,3 +59,5 @@ var _serializeError = require("serialize-error"); | ||
}); | ||
(0, _httpClose.default)(server); | ||
const httpTerminator = (0, _httpTerminator.createHttpTerminator)({ | ||
server | ||
}); | ||
app.get('/health', (request, response) => { | ||
@@ -186,9 +188,3 @@ if (serverIsShuttingDown) { | ||
log.debug('all shutdown handlers have run to completion; proceeding to terminate the Node.js process'); | ||
server.close(error => { | ||
if (error) { | ||
log.error({ | ||
error: (0, _serializeError.serializeError)(error) | ||
}, 'server was terminated with an error'); | ||
} | ||
}); | ||
await httpTerminator.terminate(); | ||
setTimeout(() => { | ||
@@ -195,0 +191,0 @@ log.warn('process did not exit on its own; investigate what is keeping the event loop active'); // eslint-disable-next-line no-process-exit |
@@ -24,3 +24,3 @@ { | ||
"express": "^4.17.1", | ||
"http-close": "^1.0.0", | ||
"http-terminator": "^1.2.2", | ||
"roarr": "^2.14.6", | ||
@@ -89,3 +89,3 @@ "serialize-error": "^5.0.0" | ||
}, | ||
"version": "6.0.0" | ||
"version": "6.0.1" | ||
} |
@@ -7,4 +7,6 @@ // @flow | ||
import express from 'express'; | ||
import httpClose from 'http-close'; | ||
import { | ||
createHttpTerminator, | ||
} from 'http-terminator'; | ||
import { | ||
serializeError, | ||
@@ -72,3 +74,5 @@ } from 'serialize-error'; | ||
httpClose(server); | ||
const httpTerminator = createHttpTerminator({ | ||
server, | ||
}); | ||
@@ -216,9 +220,3 @@ app.get('/health', (request, response) => { | ||
server.close((error) => { | ||
if (error) { | ||
log.error({ | ||
error: serializeError(error), | ||
}, 'server was terminated with an error'); | ||
} | ||
}); | ||
await httpTerminator.terminate(); | ||
@@ -225,0 +223,0 @@ setTimeout(() => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
68894
-0.58%569
-1.04%+ Added
+ Added
- Removed
- Removed
- Removed