taskworker: better logs on signal

This commit is contained in:
Girish Ramakrishnan
2025-06-17 22:30:34 +02:00
parent 1354da01e6
commit a9f474b24d

View File

@@ -87,7 +87,10 @@ async function main() {
const debug = require('debug')('box:taskworker'); // require this here so that logging handler is already setup
process.on('SIGTERM', () => exitSync({ code: 0 })); // sent as timeout notification
process.on('SIGTERM', () => {
debug('Terminated');
exitSync({ code: 0 });
});
// ensure we log task crashes with the task logs. neither console.log nor debug are sync for some reason
process.on('uncaughtException', (error) => exitSync({ error, code: 1 }));