From 5a0ac322da6484f29223625bb4d257c1f6862e71 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 25 Feb 2017 15:44:28 +0300 Subject: [PATCH] fixed cache override bug --- routes/shepherd.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/routes/shepherd.js b/routes/shepherd.js index 6154d06..e2b3746 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -294,10 +294,12 @@ shepherd.get('/cache-one', function(req, res, next) { outObj = JSON.parse(fs.readFileSync(iguanaDir + '/cache-' + pubkey + '.json', 'utf8')); if (!outObj || !outObj.basilisk) { + console.log('no local basilisk info'); outObj['basilisk'] = {}; outObj['basilisk'][coin] = {}; } else { - if (!outObj[coin]) { + if (!outObj['basilisk'][coin]) { + console.log('no local coin info'); outObj['basilisk'][coin] = {}; } } @@ -333,7 +335,10 @@ shepherd.get('/cache-one', function(req, res, next) { } //console.log(JSON.stringify(dexUrls)); console.log(coin + ' address ' + address); - outObj.basilisk[coin][address] = {}; + if (!outObj.basilisk[coin][address]) { + outObj.basilisk[coin][address] = {}; + writeCache(); + } writeCache(); async.forEachOf(_dexUrls, function(dexUrl, key) {