|
1 | 1 | /* eslint-disable sonarjs/cognitive-complexity */ |
2 | | -import { isFunction, isAsyncFunction, isNumber, millisecondsToMinutes, isString, isBoolean } from 'sat-utils'; |
| 2 | +import { isFunction, isAsyncFunction, isNumber, millisecondsToMinutes, isString, isBoolean, sleep } from 'sat-utils'; |
3 | 3 | import { internalLogProcessResult } from './logger.execution'; |
4 | 4 | import { execute } from './exec'; |
5 | 5 | import { logger } from './logger'; |
@@ -39,15 +39,16 @@ function buildExecRunner(notRetriable, runOpts) { |
39 | 39 | } |
40 | 40 | const execProc = execute(cmd, logProcessResult, executionHolder, execOpts); |
41 | 41 |
|
42 | | - const killTooLongExecution = procWhatShouldBeKilled => { |
| 42 | + const killTooLongExecution = (procWhatShouldBeKilled: typeof execProc) => { |
43 | 43 | const executionTime = +Date.now() - startTime; |
44 | 44 | if (executionTime > longestProcessTime) { |
45 | | - if (executionTime - longestProcessTime > 5000) { |
| 45 | + if (executionTime - longestProcessTime > 7500) { |
46 | 46 | procWhatShouldBeKilled.emit('exit', 100, 'PRO_RERUN_KILL'); |
47 | 47 | procWhatShouldBeKilled.emit('close', 100, 'PRO_RERUN_KILL'); |
| 48 | + logger.error(`Process just marked manually as killed but it is possible that it is still running`); |
48 | 49 | } else { |
49 | | - logger.info(`Process killed due to long time execution: ${millisecondsToMinutes(executionTime)}`); |
50 | | - procWhatShouldBeKilled.kill('SIGKILL'); |
| 50 | + logger.info(`Process killed due to long time execution: ${millisecondsToMinutes(executionTime)}\n${cmd}}`); |
| 51 | + process.kill(procWhatShouldBeKilled.pid); |
51 | 52 | } |
52 | 53 | } |
53 | 54 | }; |
|
0 commit comments