Browse Source

redis

master
zeus 4 years ago
parent
commit
88794d1ac3
  1. 31
      swarmlab-app/src/run/app.js

31
swarmlab-app/src/run/app.js

@ -421,9 +421,17 @@ function onCollection(err, collection) {
var pathfileval = pathmodule.basename(data.tailed_path);
var arrfile = pathfileval.toString().split("-");
var pathfile = arrfile[0];
var indexfind1 = global.pipelines.findIndex(x => x.pathlogfile==pathfileval);
var indexupdate = true
//var indexfind1 = global.pipelines.findIndex(x => x.pathlogfile==pathfileval);
pubClient.hgetall(pathfileval, function(err, object) {
if(object){
indexupdate = false
}
console.log('redis '+object);
});
var resob = {}
if (indexfind1 === -1 ){
if (indexupdate ){
(async() => {
console.log('file2222222222222222222222222222222222222 ' + JSON.stringify(pathfileval))
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto
@ -438,23 +446,25 @@ function onCollection(err, collection) {
resob1.res25fileforce = resdata.data[i].res25fileforce
resob1.tailed_path = pathfileval
//resobarray.push(resob1)
pubClient.hmset(pathfileval,JSON.stringify(resob1))
var resob1string = JSON.stringify(resob1);
pubClient.hmset(pathfileval,resob1string)
pubClient.hgetall(pathfileval, function(err, object) {
console.log('redis '+object);
});
}
resob.data = resobarray
//var indexfind = global.pipelines.findIndex(x => x.res25swarmlabname==resdata.data[0].res25swarmlabname);
var indexfind = global.pipelines.findIndex(x => x.pathlogfile==pathfileval);
//var indexfind = global.pipelines.findIndex(x => x.pathlogfile==pathfileval);
//indexfind === -1 ? global.pipelines.push({resob}) : console.log("object already exists")
indexfind === -1 ? global.pipelines.push(resob) : console.log("object already exists "+pathfileval)
//indexfind === -1 ? global.pipelines.push(resob) : console.log("object already exists "+pathfileval)
reslog.log = data
reslog.date = convertDateToUTC(now)
console.log('data ' + JSON.stringify(reslog));
var usertmp = global.pipelines.find(x => x.pathlogfile==pathfileval);
var user = usertmp.data[0].user25user;
//var usertmp = global.pipelines.find(x => x.pathlogfile==pathfileval);
//var user = usertmp.data[0].user25user;
var user = "anagnostopoulos@uniwa.gr"
console.log('datauser ' + JSON.stringify(user));
io.in(user).emit("logdata", reslog);
itemsProcessed++;
@ -465,9 +475,10 @@ function onCollection(err, collection) {
reslog.log = data
reslog.date = convertDateToUTC(now)
console.log('data ' + JSON.stringify(reslog));
var usertmp = global.pipelines.find(x => x.pathlogfile==pathfileval);
var user = usertmp.data[0].user25user;
console.log('datauser ' + JSON.stringify(user));
//var usertmp = global.pipelines.find(x => x.pathlogfile==pathfileval);
//var user = usertmp.data[0].user25user;
///console.log('datauser ' + JSON.stringify(user));
var user = "anagnostopoulos@uniwa.gr"
io.in(user).emit("logdata", reslog);
itemsProcessed++;
}

Loading…
Cancel
Save