Browse Source

prox

master
zeus 4 years ago
parent
commit
e02698ab9f
  1. 8
      swarmlab-app/src/run/app.js

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

@ -430,6 +430,11 @@ cors(corsOptions), (req, res, next) => {
//function getSHA256ofJSON(input){
// return require("crypto").createHash("sha256").update(JSON.stringify(input)).digest("hex");
//}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getSHA256ofJSON(data, inputEncoding, encoding){
if (!data) {
return '';
@ -444,6 +449,9 @@ function getSHA256ofJSON(data, inputEncoding, encoding){
async function getkey(key) {
return new Promise((resolve) => {
const randomTimeInMs = Math.random() * (2000);
await sleep(randomTimeInMs);
pubClient.get(key, function (err, reply) {
if(err){

Loading…
Cancel
Save