From 1ec1ec8b7c824b4b70fd6e04b55a98a54f6ac114 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Mon, 24 Feb 2020 18:38:12 -0400 Subject: [PATCH] use retry routine with force retry --- services/gunDB/contact-api/utils/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/services/gunDB/contact-api/utils/index.js b/services/gunDB/contact-api/utils/index.js index 9e1683c8..a71ef8ec 100644 --- a/services/gunDB/contact-api/utils/index.js +++ b/services/gunDB/contact-api/utils/index.js @@ -202,11 +202,15 @@ const successfulHandshakeAlreadyExists = async recipientPub => { * @returns {Promise} */ const recipientToOutgoingID = async recipientPub => { - const maybeEncryptedOutgoingID = await require('../../Mediator/index') - .getUser() - .get(Key.RECIPIENT_TO_OUTGOING) - .get(recipientPub) - .then() + const maybeEncryptedOutgoingID = await tryAndWait( + (_, user) => + user + .get(Key.RECIPIENT_TO_OUTGOING) + .get(recipientPub) + .then(), + // force retry in case undefined is a false negative + v => typeof v === 'undefined' + ) if (typeof maybeEncryptedOutgoingID === 'string') { const outgoingID = await require('../../Mediator/index').mySEA.decrypt(