Skip to content

Commit

Permalink
Server start is now async #2559
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Apr 19, 2022
1 parent 23447aa commit 0de34a7
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions verification/curator-service/api/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import app from './index';
import makeApp from './index';
import { logger } from './util/logger';

// Start Express server.
const server = app.listen(app.get('port'), () => {
logger.info(`Curator service listening on port ${app.get('port')}`);
logger.info(' Press CTRL-C to stop\n');
});
let server;

// Set global 1-hour timeout.
// TODO: Make this more fine-grained once we fix
// https://github.com/globaldothealth/list/issues/961.
server.setTimeout(60 * 60 * 1000);
makeApp().then(app => {
server = app.listen(app.get('port'), () => {
logger.info(`Curator service listening on port ${app.get('port')}`);
logger.info(' Press CTRL-C to stop\n');
});
// Set global 1-hour timeout.
// TODO: Make this more fine-grained once we fix
// https://github.com/globaldothealth/list/issues/961.
server.setTimeout(60 * 60 * 1000);
})
.catch(e => {
logger.error('Could not start server!', e);
process.exit(1);
});

export default server;

0 comments on commit 0de34a7

Please sign in to comment.