Browse Source

async

master
zeus 4 years ago
parent
commit
68797e3cfa
  1. 18
      swarmlab-app/src/run/app.js

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

@ -431,12 +431,12 @@ function onCollection(err, collection) {
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));
@ -446,8 +446,7 @@ function onCollection(err, collection) {
var indexupdate = "yes"
var resob = {}
//var indexfind1 = global.pipelines.findIndex(x => x.pathlogfile==pathfileval);
pubClient.get(pathfileval, function(err, object) {
await pubClient.get(pathfileval, function(err, object) {
console.log('----------------' + err + '<<<<<<<<<<<<<<<<<<<<<<' + object);
if(object){
indexupdate = "no"
@ -456,7 +455,6 @@ function onCollection(err, collection) {
}
console.log('update '+JSON.stringify(indexupdate));
if (indexupdate == "yes" ){
(async() => {
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto
var resdata = await getpipelines(token,pathfile)
resob.pathlogfile = pathfileval
@ -477,7 +475,7 @@ function onCollection(err, collection) {
var user = resob1.res25creator
console.log('datauser ' + JSON.stringify(user));
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(reslog));
pubClient.get(issend, function(err, object) {
await pubClient.get(issend, function(err, object) {
if(err == null){
pubClient.set(issend, itemsProcessed, function(err, res) {
io.in(user).emit("logdata", reslog);
@ -485,9 +483,8 @@ function onCollection(err, collection) {
}
itemsProcessed++;
});
})()
}else{
pubClient.get(pathfileval, function(err, object) {
await pubClient.get(pathfileval, function(err, object) {
var objecttmp = JSON.parse(object);
var resob1 = {}
resob1.data = objecttmp.res25swarmlabname
@ -503,9 +500,7 @@ function onCollection(err, collection) {
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) {
await pubClient.get(issend, function(err, object) {
if(err == null){
pubClient.set(issend, itemsProcessed, function(err, res) {
io.in(user).emit("logdata", reslog);
@ -515,7 +510,8 @@ function onCollection(err, collection) {
});
});
}
});
}); //redis get
})() //async
});

Loading…
Cancel
Save