Do not retry and wait, let GunSmith handle
This commit is contained in:
parent
289fe1c918
commit
6ec931e1fa
1 changed files with 26 additions and 39 deletions
|
|
@ -2288,26 +2288,17 @@ module.exports = async (
|
|||
epubForDecryption
|
||||
}) => {
|
||||
const keys = path.split('>')
|
||||
const { tryAndWait } = require('../services/gunDB/contact-api/utils')
|
||||
return tryAndWait((gun, user) => {
|
||||
const { gun, user } = require('../services/gunDB/Mediator')
|
||||
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
let node = startFromUserGraph
|
||||
? user
|
||||
: publicKey
|
||||
? gun.user(publicKey)
|
||||
: gun
|
||||
logger.info(`fetching: ${keys}`)
|
||||
keys.forEach(key => (node = node.get(key)))
|
||||
|
||||
if (!publicKeyForDecryption || !epubForDecryption) {
|
||||
logger.warn('[GUN] Missing public key for decryption!', {
|
||||
publicKeyForDecryption,
|
||||
epubForDecryption
|
||||
})
|
||||
}
|
||||
|
||||
logger.info(`fetching: ${keys}`)
|
||||
return new Promise((res, rej) => {
|
||||
try {
|
||||
const listener = data => {
|
||||
logger.info(`got res for: ${keys}`)
|
||||
logger.info(data || 'falsey data (does not get logged)')
|
||||
|
|
@ -2326,10 +2317,6 @@ module.exports = async (
|
|||
|
||||
if (type === 'once') node.once(listener)
|
||||
if (type === 'load') node.load(listener)
|
||||
} catch (err) {
|
||||
logger.error('Gun Fetch Error:', err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue