Skip to content

Commit

Permalink
feat: ensure graceful termination of the Lightship service itself
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jan 18, 2020
1 parent 722a35f commit 2989802
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dependencies": {
"delay": "^4.3.0",
"express": "^4.17.1",
"http-close": "^1.0.0",
"roarr": "^2.14.6",
"serialize-error": "^5.0.0"
},
Expand Down
3 changes: 3 additions & 0 deletions src/factories/createLightship.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import EventEmitter from 'events';
import delay from 'delay';
import express from 'express';
import httpClose from 'http-close';
import {
serializeError,
} from 'serialize-error';
Expand Down Expand Up @@ -67,6 +68,8 @@ export default (userConfiguration?: ConfigurationInputType): LightshipType => {
log.info('Lightship HTTP service is running on port %s', server.address().port);
});

httpClose(server);

app.get('/health', (request, response) => {
if (serverIsShuttingDown) {
response.status(500).send(SERVER_IS_SHUTTING_DOWN);
Expand Down

0 comments on commit 2989802

Please # to comment.