Browse Source

redis

master
zeus 4 years ago
parent
commit
0c9a10cabc
  1. 92
      swarmlab-app/src/run/app.js

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

@ -427,64 +427,49 @@ function onCollection(err, collection) {
(async() => { (async() => {
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto
var resdata = await getpipelines(token,pathfile) var resdata = await getpipelines(token,pathfile)
console.log('------------------------------ ' + JSON.stringify(resdata.data))
resob.pathlogfile = pathfileval resob.pathlogfile = pathfileval
var resobarray = [] var resobarray = []
//for (let i in resdata.data) { var resob1 = {}
var resob1 = {} var i = 0
var i = 0 resob1.data = resdata.data[i].res25swarmlabname
resob1.data = resdata.data[i].res25swarmlabname resob1.user25user = resdata.data[i].res25user
resob1.user25user = resdata.data[i].res25user resob1.res25creator = resdata.data[i].res25creator
resob1.res25creator = resdata.data[i].res25creator resob1.res25fileforce = resdata.data[i].res25fileforce
resob1.res25fileforce = resdata.data[i].res25fileforce resob1.tailed_path = pathfileval
resob1.tailed_path = pathfileval //resobarray.push(resob1)
resobarray.push(resob1) var resob1string = JSON.stringify(resob1);
var resob1string = JSON.stringify(resob1); console.log('+++++++++++++++++' + resob1string + '<<<<<<<<<<<<<<<<<<<<<<' + pathfileval);
console.log('+++++++++++++++++' + resob1string + '<<<<<<<<<<<<<<<<<<<<<<' + pathfileval); await pubClient.set(pathfileval, resob1string, function(err, res) {
//pubClient.hmset(pathfileval,resob1string) });
pubClient.set(pathfileval, resob1string, function(err, res) { reslog.data = resob1
reslog.log = data
}); reslog.date = convertDateToUTC(now)
await pubClient.get(pathfileval, function(err, object) { console.log('>>>11111111111111>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(object));
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(object)); var user = resob1.res25creator
}); console.log('datauser ' + JSON.stringify(user));
//} io.in(user).emit("logdata", reslog);
resob.data = resobarray itemsProcessed++;
//var indexfind = global.pipelines.findIndex(x => x.res25swarmlabname==resdata.data[0].res25swarmlabname);
//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)
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;
await pubClient.get(pathfileval, function(err, object) {
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(object));
var user = object.user25user
});
console.log('datauser ' + JSON.stringify(user));
io.in(user).emit("logdata", reslog);
itemsProcessed++;
})() })()
}else{ }else{
reslog.log = data pubClient.get(pathfileval, function(err, object) {
reslog.date = convertDateToUTC(now) var resob1 = {}
//console.log('dataelse ' + JSON.stringify(reslog)); var i = 0
//var usertmp = global.pipelines.find(x => x.pathlogfile==pathfileval); resob1.data = object.res25swarmlabname
//var user = usertmp.data[0].user25user; resob1.user25user = object.res25user
///console.log('datauser ' + JSON.stringify(user)); resob1.res25creator = object.res25creator
//var user = "anagnostopoulos@uniwa.gr" resob1.res25fileforce = object.res25fileforce
pubClient.get(pathfileval, function(err, object) { resob1.tailed_path = object.tailed_path
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(object));
var user = object.user25user reslog.data = resob1
}); reslog.log = data
io.in(user).emit("logdata", reslog); reslog.date = convertDateToUTC(now)
itemsProcessed++;
console.log('>>>>>>>>>>2222222222222>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(object));
var user = object.user25user
io.in(user).emit("logdata", reslog);
itemsProcessed++;
});
} }
}); });
@ -500,7 +485,6 @@ function onCollection(err, collection) {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true useUnifiedTopology: true
}; };
//var mongolab_uri = "mongodb://<dbUser>:<dbPassword>@<host1>:<port1>,<host2>:<port2>/<dbName>?replicaSet=<replicaSetName>";
var mongooptions = { var mongooptions = {
autoReconnect: true, autoReconnect: true,
keepAlive: 1, keepAlive: 1,

Loading…
Cancel
Save