parent
a81688ddd1
commit
fd7f751523
3 changed files with 13 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
||||||
"chalk": "^2.0.1",
|
"chalk": "^2.0.1",
|
||||||
"elastic-queue": "^0.3.0",
|
"elastic-queue": "^0.3.0",
|
||||||
"elasticsearch": "^13.2.0",
|
"elasticsearch": "^13.2.0",
|
||||||
|
"file-exists": "^4.0.0",
|
||||||
"glob": "^7.1.1",
|
"glob": "^7.1.1",
|
||||||
"jsonfile": "^3.0.1",
|
"jsonfile": "^3.0.1",
|
||||||
"jsonwebtoken": "^7.2.1",
|
"jsonwebtoken": "^7.2.1",
|
||||||
|
|
|
@ -10,6 +10,8 @@ import jsonfile from 'jsonfile';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import rp from 'request-promise';
|
import rp from 'request-promise';
|
||||||
import appRoot from 'app-root-path';
|
import appRoot from 'app-root-path';
|
||||||
|
import fs from 'fs';
|
||||||
|
import fileExists from 'file-exists';
|
||||||
|
|
||||||
const loggerStream = winstonStream(winston, 'info');
|
const loggerStream = winstonStream(winston, 'info');
|
||||||
const eclient = new elasticsearch.Client({
|
const eclient = new elasticsearch.Client({
|
||||||
|
@ -33,6 +35,12 @@ let status = {};
|
||||||
|
|
||||||
export async function sync () {
|
export async function sync () {
|
||||||
try {
|
try {
|
||||||
|
fileExists(path.join(appRoot.path, 'claimTrieCache.json'), (err, exists) => {
|
||||||
|
if (err) { throw err };
|
||||||
|
if (!exists) {
|
||||||
|
fs.writeFileSync(path.join(appRoot.path, 'claimTrieCache.json'), '[]');
|
||||||
|
}
|
||||||
|
});
|
||||||
status.info = 'Grabbing the claimTrie...';
|
status.info = 'Grabbing the claimTrie...';
|
||||||
let claimTrie = await client.getClaimsInTrie().then(claimtrie => { return claimtrie }).catch(err => { throw err });
|
let claimTrie = await client.getClaimsInTrie().then(claimtrie => { return claimtrie }).catch(err => { throw err });
|
||||||
let txList = [];
|
let txList = [];
|
||||||
|
|
|
@ -1472,6 +1472,10 @@ file-entry-cache@^2.0.0:
|
||||||
flat-cache "^1.2.1"
|
flat-cache "^1.2.1"
|
||||||
object-assign "^4.0.1"
|
object-assign "^4.0.1"
|
||||||
|
|
||||||
|
file-exists@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/file-exists/-/file-exists-4.0.0.tgz#104eacf25d3fd6b3e462951ae923533195ffb52b"
|
||||||
|
|
||||||
filename-regex@^2.0.0:
|
filename-regex@^2.0.0:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
|
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue