mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Increased timeout and better error handling on invoice polling
This commit is contained in:
parent
aaeb5de1fe
commit
4e894e637c
@ -58,14 +58,18 @@ export default async function handler(req, res) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check payment status
|
// Add axios timeout configuration
|
||||||
const response = await axios.get(
|
const axiosConfig = {
|
||||||
`https://${foundAddress.lndHost}:${foundAddress.lndPort}/v1/invoice/${paymentHash}`,
|
timeout: 5000, // 5 second timeout
|
||||||
{
|
|
||||||
headers: {
|
headers: {
|
||||||
'Grpc-Metadata-macaroon': foundAddress.invoiceMacaroon,
|
'Grpc-Metadata-macaroon': foundAddress.invoiceMacaroon,
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// Check payment status with timeout handling
|
||||||
|
const response = await axios.get(
|
||||||
|
`https://${foundAddress.lndHost}:${foundAddress.lndPort}/v1/invoice/${paymentHash}`,
|
||||||
|
axiosConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
@ -124,6 +128,11 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
results.processed++;
|
results.processed++;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error.code === 'ECONNRESET' || error.code === 'ETIMEDOUT') {
|
||||||
|
console.error(`Connection issue with LND node for ${foundAddress.lndHost}: ${error.message}`);
|
||||||
|
results.errors++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
console.error('Error processing invoice:', error);
|
console.error('Error processing invoice:', error);
|
||||||
results.errors++;
|
results.errors++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user