From 707e144eff9459540211ed6809df3cab18a711c2 Mon Sep 17 00:00:00 2001 From: jessop Date: Sun, 12 Jan 2020 18:48:52 -0500 Subject: [PATCH] pagination (thanks Tom) --- .travis.yml | 2 +- server/chainquery/queries/claimQueries.js | 4 ++++ server/utils/awaitFileSize.js | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a3fcdde..972a1d87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ dist: xenial # - mysql-client language: node_js node_js: - - "lts/*" + - "lts/dubnium" cache: directories: - "node_modules" diff --git a/server/chainquery/queries/claimQueries.js b/server/chainquery/queries/claimQueries.js index 6270ea5d..cd8c8a2f 100644 --- a/server/chainquery/queries/claimQueries.js +++ b/server/chainquery/queries/claimQueries.js @@ -201,6 +201,10 @@ export default (db, table, sequelize) => ({ } return claimArray[0]; + }) + .catch(error => { + logger.verbose(`resolveClaim failed: ${error}`) + reject(error); }); }, diff --git a/server/utils/awaitFileSize.js b/server/utils/awaitFileSize.js index c1a9543e..196f2ba5 100644 --- a/server/utils/awaitFileSize.js +++ b/server/utils/awaitFileSize.js @@ -13,8 +13,10 @@ const awaitFileSize = (outpoint, size, interval, timeout) => { function checkFileList() { logger.debug('checkFileList'); return getFileListFileByOutpoint(outpoint).then(result => { - logger.debug('File List Result', result); - if (result[0]['completed'] === true || result[0]['written_bytes'] > size) { + const { items: fileInfos } = result; + const fileInfo = fileInfos[0]; + logger.debug('File List Result', fileInfo); + if (fileInfo.completed === true || fileInfo.written_bytes > size) { logger.debug('FILE READY'); return 'ready'; } else if (timeout !== 0 && Date.now() - start > timeout) {