From d21f764ef6c56e12f8553730ef975172fb77bbde Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Sep 2024 15:35:18 -0700 Subject: reconnect mqtt --- lib/payments.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/payments.ts b/lib/payments.ts index f46a0a6a..5d578af9 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -224,6 +224,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { } if (config.mqtt1) { + if (!mqtt1.connected) await mqtt1.reconnect(); mqtt1.publish( username, `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}:${p.memo}:${items}`, @@ -231,6 +232,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { } if (config.mqtt2) { + if (!mqtt2.connected) await mqtt2.reconnect(); mqtt2.publish( username, `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}:${p.memo}:${items}`, @@ -611,7 +613,9 @@ export let build = async ({ amount, address, feeRate, user, subtract }) => { amount = parseInt(amount); if (amount < 0) fail("invalid amount"); - let fees: any = await fetch(`${api[type]}/fees/recommended`).then((r) => r.json()); + let fees: any = await fetch(`${api[type]}/fees/recommended`).then((r) => + r.json(), + ); if (!feeRate) { feeRate = fees.halfHourFee; -- cgit v1.2.3