HUGE Refactoring Superalgos Project to Foundations Project done

This commit is contained in:
Luis Fernando Molina committed 2021-06-09 22:21:01 +02:00
1 parent c9c0aeaca7
commit 87edcc043d
3557 files changed
+10791 -10789

No files matched your search

+10 -10
View File
@@ -12,25 +12,25 @@ exports.newNodeJsProcess = function () {
console.log('[ERROR] Task Server -> Node JS Process -> uncaughtException -> err.message = ' + err.message)
console.log('[ERROR] Task Server -> Node JS Process -> uncaughtException -> err.stack = ' + err.stack)
console.log(err.stack)
TS.projects.superalgos.functionLibraries.nodeJSFunctions.exitProcess()
TS.projects.foundations.functionLibraries.nodeJSFunctions.exitProcess()
})
process.on('unhandledRejection', (reason, p) => {
console.log('[ERROR] Task Server -> Node JS Process -> unhandledRejection -> reason = ' + JSON.stringify(reason))
console.log('[ERROR] Task Server -> Node JS Process -> unhandledRejection -> p = ' + JSON.stringify(p))
console.log(reason.stack)
TS.projects.superalgos.functionLibraries.nodeJSFunctions.exitProcess()
TS.projects.foundations.functionLibraries.nodeJSFunctions.exitProcess()
})
process.on('exit', function (config) {
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE !== undefined) {
if (TS.projects.foundations.globals.taskConstants.TASK_NODE !== undefined) {
/* We send an event signaling that the Task is being terminated. */
let key = TS.projects.superalgos.globals.taskConstants.TASK_NODE.name + '-' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.type + '-' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.id
let key = TS.projects.foundations.globals.taskConstants.TASK_NODE.name + '-' + TS.projects.foundations.globals.taskConstants.TASK_NODE.type + '-' + TS.projects.foundations.globals.taskConstants.TASK_NODE.id
TS.projects.superalgos.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.raiseEvent(key, 'Stopped') // Meaning Task Stopped
TS.projects.superalgos.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.finalize()
TS.projects.superalgos.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT = undefined
TS.projects.foundations.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.raiseEvent(key, 'Stopped') // Meaning Task Stopped
TS.projects.foundations.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT.finalize()
TS.projects.foundations.globals.taskConstants.EVENT_SERVER_CLIENT_MODULE_OBJECT = undefined
}
//console.log('[INFO] Task Server -> Node JS Process -> process.on.exit -> About to exit -> config = ' + config)
@@ -40,15 +40,15 @@ exports.newNodeJsProcess = function () {
process.on('message', message => {
if (message === 'Stop this Task') {
TS.projects.superalgos.globals.taskVariables.IS_TASK_STOPPING = true;
TS.projects.foundations.globals.taskVariables.IS_TASK_STOPPING = true;
/*
There are some process that might no be able to end grafully, for example the ones schedulle to process information in a future day or month.
In order to be sure that the process will be terminated, we schedulle one forced exit in 2 minutes from now.
*/
let key = TS.projects.superalgos.globals.taskConstants.TASK_NODE.name + '-' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.type
let key = TS.projects.foundations.globals.taskConstants.TASK_NODE.name + '-' + TS.projects.foundations.globals.taskConstants.TASK_NODE.type
console.log('[INFO] Task Server -> Node JS Process -> process.on -> Stopping Task ' + key + '. Nodejs process will be exited in less than 1 minute.')
setTimeout(TS.projects.superalgos.functionLibraries.nodeJSFunctions.exitProcess, 60000);
setTimeout(TS.projects.foundations.functionLibraries.nodeJSFunctions.exitProcess, 60000);
}
});