Browse Source

redis

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

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

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

Loading…
Cancel
Save