From fbb06aae3bc0e61638e0682af5fcd5ed20eb82b0 Mon Sep 17 00:00:00 2001 From: zeus Date: Fri, 27 Nov 2020 21:46:49 +0200 Subject: [PATCH] sync redis --- swarmlab-app/src/run/app.js | 64 +++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index a469ac9..8af071f 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -474,7 +474,7 @@ function onCollection(err, collection) { console.log('datauser ' + JSON.stringify(user)); console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(reslog)); pubClient.get(issend, function(err, object) { - if(err == null){ + if(ocject == null){ pubClient.set(issend, itemsProcessed, function(err, res) { io.in(user).emit("logdata", reslog); }); @@ -483,41 +483,35 @@ function onCollection(err, collection) { }); })() }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); - - //console.log("RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRr", JSON.stringify(io.sockets.adapter.rooms)); // Set { } - - pubClient.get(issend, function(err, object) { - if(err == null){ - pubClient.set(issend, itemsProcessed, function(err, res) { - io.in(user).emit("logdata", reslog); - }); - } - itemsProcessed++; + 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(ocject == null){ + pubClient.set(issend, itemsProcessed, function(err, res) { + io.in(user).emit("logdata", reslog); + }); + } + itemsProcessed++; + }); }); - //io.in(user).emit("logdata", reslog); - //itemsProcessed++; - }); - } - }); + } + }); });