From 1a57e26d217596d0634a80772cb7ae62eda2be99 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Fri, 18 Aug 2017 14:05:36 -0700 Subject: [PATCH] removed updateClaimAmount script --- updateClaimAmount.js | 50 -------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 updateClaimAmount.js diff --git a/updateClaimAmount.js b/updateClaimAmount.js deleted file mode 100644 index d1a99767..00000000 --- a/updateClaimAmount.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - This script will update all the records in the Claim table and update the amount. -*/ -let db = require('./models'); -const lbryApi = require('./helpers/lbryApi.js'); -let sleep = require('sleep'); - -// configure logging -const config = require('config'); -const logger = require('winston'); -const logLevel = config.get('Logging.LogLevel'); -require('./config/loggerSetup.js')(logger, logLevel); - -// start the server -db.sequelize - .sync() // sync sequelize - .then(() => { // get the download directory from the daemon - console.log('db has synced'); - console.log('retrieving files'); - return db.Claim.findAll({where: {amount: null}}); - }) - .then(result => { - const totalResults = result.length; - console.log('total results found:', totalResults); - console.log('starting update...'); - sleep.sleep(2); - result.forEach((record, index) => { - const uri = `${record.name}#${record.claimId}`; - setTimeout(() => { - lbryApi.resolveUri(uri) - .then(result => { - console.log('resolve worked! :)'); - if (result['claim']) { - const amount = result['claim'].amount; - return record.update({ amount }); - } - }) - .then(() => { - if (index + 1 === totalResults) { - console.log('All done.'); - process.exit(0); - } - }) - .catch(error => console.log('error getting/setting amount >>', error)); - }, 100 * index, uri); - }); - }) - .catch((error) => { - console.log('error getting record >>', error); - });