|
|
@ -420,25 +420,25 @@ function getSHA256ofJSON(input){ |
|
|
|
|
|
|
|
|
|
|
|
function onCollection(err, collection) { |
|
|
|
let options = { tailable: true, |
|
|
|
awaitdata: true, |
|
|
|
numberOfRetries: -1, |
|
|
|
tailableRetryInterval: 500 |
|
|
|
}; |
|
|
|
var cursor = collection.find({},options).stream(); |
|
|
|
var itemsProcessed = 0; |
|
|
|
|
|
|
|
var reslog = new Object(); |
|
|
|
var now = new Date(); |
|
|
|
cursor.on('data', function (data) { |
|
|
|
let options = { tailable: true, |
|
|
|
awaitdata: true, |
|
|
|
numberOfRetries: -1, |
|
|
|
tailableRetryInterval: 500 |
|
|
|
}; |
|
|
|
var cursor = collection.find({},options).stream(); |
|
|
|
var itemsProcessed = 0; |
|
|
|
|
|
|
|
var reslog = new Object(); |
|
|
|
var now = new Date(); |
|
|
|
cursor.on('data', function (data) { |
|
|
|
(async() => { |
|
|
|
var issendob = {}; |
|
|
|
issendob.message = data.message |
|
|
|
issendob.tailed_path = data.tailed_path |
|
|
|
|
|
|
|
var issend = getSHA256ofJSON(issendob) |
|
|
|
//io.in('anagnostopoulos@uniwa.gr').emit("logdata", data);
|
|
|
|
|
|
|
|
console.log('++++++++' + JSON.stringify(data)); |
|
|
|
console.log('++++++++' + JSON.stringify(data)); |
|
|
|
|
|
|
|
var pathfileval = pathmodule.basename(data.tailed_path); |
|
|
|
var arrfile = pathfileval.toString().split("-"); |
|
|
@ -446,76 +446,72 @@ function onCollection(err, collection) { |
|
|
|
|
|
|
|
var indexupdate = "yes" |
|
|
|
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)); |
|
|
|
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)); |
|
|
|
pubClient.get(issend, function(err, object) { |
|
|
|
if(err == null){ |
|
|
|
pubClient.set(issend, itemsProcessed, function(err, res) { |
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
await 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)); |
|
|
|
if (indexupdate == "yes" ){ |
|
|
|
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) { |
|
|
|
}); |
|
|
|
} |
|
|
|
itemsProcessed++; |
|
|
|
}); |
|
|
|
})() |
|
|
|
}else{ |
|
|
|
pubClient.get(pathfileval, function(err, object) { |
|
|
|
var objecttmp = JSON.parse(object); |
|
|
|
var resob1 = {} |
|
|
|
resob1.data = objecttmp.res25swarmlabname |
|
|
|
resob1.user25user = objecttmp.res25user |
|
|
|
resob1.res25creator = objecttmp.res25creator |
|
|
|
resob1.res25fileforce = objecttmp.res25fileforce |
|
|
|
resob1.tailed_path = objecttmp.tailed_path |
|
|
|
|
|
|
|
reslog.data = resob1 |
|
|
|
reslog.log = data |
|
|
|
reslog.date = convertDateToUTC(now) |
|
|
|
|
|
|
|
console.log('<<<<<<<<<<<---------------------<<<<<<<<<<<<<<<---------------------------<<<<<<<<<<<< '+JSON.stringify(object)); |
|
|
|
console.log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< '+JSON.stringify(reslog)); |
|
|
|
var user = objecttmp.user25user |
|
|
|
//io.join(user);
|
|
|
|
//io.to(user).emit(reslog);
|
|
|
|
pubClient.get(issend, function(err, object) { |
|
|
|
if(err == null){ |
|
|
|
pubClient.set(issend, itemsProcessed, 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)); |
|
|
|
await pubClient.get(issend, function(err, object) { |
|
|
|
if(err == null){ |
|
|
|
pubClient.set(issend, itemsProcessed, function(err, res) { |
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
}); |
|
|
|
} |
|
|
|
itemsProcessed++; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
itemsProcessed++; |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
await pubClient.get(pathfileval, function(err, object) { |
|
|
|
var objecttmp = JSON.parse(object); |
|
|
|
var resob1 = {} |
|
|
|
resob1.data = objecttmp.res25swarmlabname |
|
|
|
resob1.user25user = objecttmp.res25user |
|
|
|
resob1.res25creator = objecttmp.res25creator |
|
|
|
resob1.res25fileforce = objecttmp.res25fileforce |
|
|
|
resob1.tailed_path = objecttmp.tailed_path |
|
|
|
|
|
|
|
reslog.data = resob1 |
|
|
|
reslog.log = data |
|
|
|
reslog.date = convertDateToUTC(now) |
|
|
|
|
|
|
|
console.log('<<<<<<<<<<<---------------------<<<<<<<<<<<<<<<---------------------------<<<<<<<<<<<< '+JSON.stringify(object)); |
|
|
|
console.log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< '+JSON.stringify(reslog)); |
|
|
|
var user = objecttmp.user25user |
|
|
|
await pubClient.get(issend, function(err, object) { |
|
|
|
if(err == null){ |
|
|
|
pubClient.set(issend, itemsProcessed, function(err, res) { |
|
|
|
io.in(user).emit("logdata", reslog); |
|
|
|
}); |
|
|
|
} |
|
|
|
itemsProcessed++; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); //redis get
|
|
|
|
})() //async
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|