Skip to content

Commit

Permalink
Exit on initializatopn timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
tshemsedinov committed Aug 13, 2022
1 parent d31792c commit 86f2965
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased][unreleased]

- Exit on initializatopn timeout

## [3.0.0-alpha.4][] - 2022-07-30

- Fix scheduler: task id, unknown app, etc.
Expand Down
9 changes: 5 additions & 4 deletions impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const exit = async (message) => {
};

const logError = (type) => (err) => {
const msg = err.stack || err.message || 'no stack trace';
const msg = err?.stack || err?.message || 'exit';
impress.console.error(`${type}: ${msg}`);
if (impress.finalization) return;
if (impress.initialization) exit('Can not start Application server');
Expand Down Expand Up @@ -205,9 +205,10 @@ const stop = async () => {
process.on('SIGINT', stop);
process.on('SIGTERM', stop);

impress.startTimer = setTimeout(() => {
impress.console.warn(`Initialization timeout`);
}, config.server.timeouts.start);
impress.startTimer = setTimeout(
logError('Initialization timeout'),
config.server.timeouts.start,
);

await loadApplications();

Expand Down

0 comments on commit 86f2965

Please sign in to comment.