Session Heart Beat
This commit is contained in:
1 parent
a69b44b907
commit
0bb9208d66
4 files changed
+42
-42
No files matched your search
@@ -1,6 +1,7 @@
|
||||
exports.newSuperalgosFunctionLibrariesSessionFunctions = function () {
|
||||
|
||||
let thisObject = {
|
||||
sessionHeartBeat: sessionHeartBeat,
|
||||
stopSession: stopSession,
|
||||
emitSessionStatus: emitSessionStatus,
|
||||
finalizeSessions: finalizeSessions,
|
||||
@@ -11,6 +12,23 @@ exports.newSuperalgosFunctionLibrariesSessionFunctions = function () {
|
||||
|
||||
return thisObject
|
||||
|
||||
function sessionHeartBeat(processIndex, logger, processingDate, percentage, status) {
|
||||
let event = {
|
||||
seconds: (new Date()).getSeconds(),
|
||||
processingDate: processingDate,
|
||||
percentage: percentage,
|
||||
status: status
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_KEY, 'Heartbeat', event)
|
||||
|
||||
if (TS.projects.superalgos.globals.taskVariables.IS_TASK_STOPPING === true) {
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).IS_SESSION_STOPPING = true
|
||||
if (logger !== undefined) {
|
||||
logger.write(MODULE_NAME, '[IMPORTANT] sessionHeartBeat -> Stopping the Session now. ')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function stopSession(processIndex, commandOrigin) {
|
||||
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).SOCIAL_BOTS_MODULE.sendMessage(TS.projects.superalgos.globals.processConstants.CONSTANTS_BY_PROCESS_INDEX_MAP.get(processIndex).SESSION_NODE.type + " '" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].session.name + "' is stopping " + commandOrigin)
|
||||
|
||||
Reference in new issue
Block a user