|
|
@ -414,6 +414,9 @@ cors(corsOptions), (req, res, next) => { |
|
|
|
// socket
|
|
|
|
// ***************************************************
|
|
|
|
|
|
|
|
function getSHA256ofJSON(input){ |
|
|
|
return crypto.createHash('sha256').update(JSON.stringify(input)).digest('hex') |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onCollection(err, collection) { |
|
|
@ -428,6 +431,7 @@ function onCollection(err, collection) { |
|
|
|
var reslog = new Object(); |
|
|
|
var now = new Date(); |
|
|
|
cursor.on('data', function (data) { |
|
|
|
var issend = getSHA256ofJSON(data) |
|
|
|
//io.in('anagnostopoulos@uniwa.gr').emit("logdata", data);
|
|
|
|
|
|
|
|
console.log('++++++++' + JSON.stringify(data)); |
|
|
@ -440,38 +444,44 @@ function onCollection(err, collection) { |
|
|
|
var resob = {} |
|
|
|
//var indexfind1 = global.pipelines.findIndex(x => x.pathlogfile==pathfileval);
|
|
|
|
pubClient.get(pathfileval, function(err, object) { |
|
|
|
console.log('----------------' + err + '<<<<<<<<<<<<<<<<<<<<<<' + object); |
|
|
|
if(object){ |
|
|
|
indexupdate = "no" |
|
|
|
}else{ |
|
|
|
console.log('redis '+JSON.stringify(object)); |
|
|
|
} |
|
|
|
console.log('update '+JSON.stringify(indexupdate)); |
|
|
|
console.log('----------------' + err + '<<<<<<<<<<<<<<<<<<<<<<' + object); |
|
|
|
if(object){ |
|
|
|
indexupdate = "no" |
|
|
|
}else{ |
|
|
|
console.log('redis '+JSON.stringify(object)); |
|
|
|
} |
|
|
|
console.log('update '+JSON.stringify(indexupdate)); |
|
|
|
if (indexupdate == "yes" ){ |
|
|
|
(async() => { |
|
|
|
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto
|
|
|
|
var resdata = await getpipelines(token,pathfile) |
|
|
|
resob.pathlogfile = pathfileval |
|
|
|
var resobarray = [] |
|
|
|
var resob1 = {} |
|
|
|
var i = 0 |
|
|
|
resob1.data = resdata.data[i].res25swarmlabname |
|
|
|
resob1.user25user = resdata.data[i].res25user |
|
|
|
resob1.res25creator = resdata.data[i].res25creator |
|
|
|
resob1.res25fileforce = resdata.data[i].res25fileforce |
|
|
|
resob1.tailed_path = pathfileval |
|
|
|
var resob1string = JSON.stringify(resob1); |
|
|
|
pubClient.set(pathfileval, resob1string, function(err, res) { |
|
|
|
}); |
|
|
|
reslog.data = resob1 |
|
|
|
reslog.log = data |
|
|
|
reslog.date = convertDateToUTC(now) |
|
|
|
var user = resob1.res25creator |
|
|
|
console.log('datauser ' + JSON.stringify(user)); |
|
|
|
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(reslog)); |
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
itemsProcessed++; |
|
|
|
})() |
|
|
|
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto
|
|
|
|
var resdata = await getpipelines(token,pathfile) |
|
|
|
resob.pathlogfile = pathfileval |
|
|
|
var resobarray = [] |
|
|
|
var resob1 = {} |
|
|
|
var i = 0 |
|
|
|
resob1.data = resdata.data[i].res25swarmlabname |
|
|
|
resob1.user25user = resdata.data[i].res25user |
|
|
|
resob1.res25creator = resdata.data[i].res25creator |
|
|
|
resob1.res25fileforce = resdata.data[i].res25fileforce |
|
|
|
resob1.tailed_path = pathfileval |
|
|
|
var resob1string = JSON.stringify(resob1); |
|
|
|
pubClient.set(pathfileval, resob1string, function(err, res) { |
|
|
|
}); |
|
|
|
reslog.data = resob1 |
|
|
|
reslog.log = data |
|
|
|
reslog.date = convertDateToUTC(now) |
|
|
|
var user = resob1.res25creator |
|
|
|
console.log('datauser ' + JSON.stringify(user)); |
|
|
|
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(reslog)); |
|
|
|
pubClient.get(issend, function(err, object) { |
|
|
|
if(err == null){ |
|
|
|
pubClient.set(issend, itemsProcessed, function(err, res) { |
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
}); |
|
|
|
} |
|
|
|
itemsProcessed++; |
|
|
|
}); |
|
|
|
})() |
|
|
|
}else{ |
|
|
|
|
|
|
|
pubClient.get(pathfileval, function(err, object) { |
|
|
@ -495,8 +505,16 @@ function onCollection(err, collection) { |
|
|
|
|
|
|
|
//console.log("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRr", JSON.stringify(io.sockets.adapter.rooms)); // Set { <socket.id> }
|
|
|
|
|
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
itemsProcessed++; |
|
|
|
pubClient.get(issend, function(err, object) { |
|
|
|
if(err == null){ |
|
|
|
pubClient.set(issend, itemsProcessed, function(err, res) { |
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
}); |
|
|
|
} |
|
|
|
itemsProcessed++; |
|
|
|
}); |
|
|
|
//io.in(user).emit("logdata", reslog);
|
|
|
|
//itemsProcessed++;
|
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|