From c3fff0a432278dc6e6bbbb71085308a6cd369f3f Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Tue, 14 Jan 2020 18:08:18 -0400 Subject: [PATCH] timeout for getter --- services/gunDB/contact-api/actions.js | 2 +- services/gunDB/contact-api/getters.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index 9a994731..e81d5ff5 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -868,7 +868,7 @@ const sendPayment = async (to, amount, memo, gun, user, SEA) => { timestamp: Date.now() } - const currOrderAddress = await Getters.currentOrderAddress(to, gun) + const currOrderAddress = await Getters.currentOrderAddress(to) order.timestamp = Date.now() diff --git a/services/gunDB/contact-api/getters.js b/services/gunDB/contact-api/getters.js index f439512a..fa704e37 100644 --- a/services/gunDB/contact-api/getters.js +++ b/services/gunDB/contact-api/getters.js @@ -1,12 +1,12 @@ const Key = require('./key') +const Utils = require('./utils') /** * @param {string} pub - * @param {import('./SimpleGUN').GUNNode} gun * @returns {Promise} */ -exports.currentOrderAddress = async (pub, gun) => { - const currAddr = await gun.user(pub).get(Key.CURRENT_ORDER_ADDRESS).then() +exports.currentOrderAddress = async (pub) => { + const currAddr = await Utils.tryAndWait((gun) => gun.user(pub).get(Key.CURRENT_ORDER_ADDRESS).then()) if (typeof currAddr !== 'string') { throw new TypeError('Expected user.currentOrderAddress to be an string')