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