diff options
| author | Adam Soltys <[email protected]> | 2024-09-06 15:35:18 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-06 15:35:18 -0700 |
| commit | d21f764ef6c56e12f8553730ef975172fb77bbde (patch) | |
| tree | c6b2b12a6da3d2983d01537dda6ff9ab5b254a91 /lib | |
| parent | 3bb28f1268243ddd6920d7446e3a060a6c11bd5c (diff) | |
| download | coinos-server-d21f764ef6c56e12f8553730ef975172fb77bbde.tar.gz coinos-server-d21f764ef6c56e12f8553730ef975172fb77bbde.zip | |
reconnect mqtt
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.ts | 6 |
1 files changed, 5 insertions, 1 deletions
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; |
