From cca43f1b2ec2c93bff7693754061b9b467e2b220 Mon Sep 17 00:00:00 2001 From: keyan Date: Fri, 7 Jan 2022 10:41:53 -0600 Subject: [PATCH] manually retry wallet polling on ln errors --- worker/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/worker/index.js b/worker/index.js index 8781ba9b..924ad970 100644 --- a/worker/index.js +++ b/worker/index.js @@ -65,7 +65,15 @@ async function repin ({ name }) { } async function checkInvoice ({ data: { hash } }) { - const inv = await getInvoice({ id: hash, lnd }) + let inv + try { + inv = await getInvoice({ id: hash, lnd }) + } catch (err) { + console.log(err) + // on lnd related errors, we manually retry which so we don't exponentially backoff + await boss.send('checkInvoice', { hash }, walletOptions) + return + } console.log(inv) if (inv.is_confirmed) { @@ -98,7 +106,9 @@ async function checkWithdrawal ({ data: { id, hash } }) { if (err[1] === 'SentPaymentNotFound') { notFound = true } else { - throw err + // on lnd related errors, we manually retry which so we don't exponentially backoff + await boss.send('checkWithdrawal', { id, hash }, walletOptions) + return } } console.log(wdrwl)