mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-05 00:32:03 +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;
|
||||
}
|
||||
|
||||
// Check payment status
|
||||
// Add axios timeout configuration
|
||||
const axiosConfig = {
|
||||
timeout: 5000, // 5 second timeout
|
||||
headers: {
|
||||
'Grpc-Metadata-macaroon': foundAddress.invoiceMacaroon,
|
||||
}
|
||||
};
|
||||
|
||||
// Check payment status with timeout handling
|
||||
const response = await axios.get(
|
||||
`https://${foundAddress.lndHost}:${foundAddress.lndPort}/v1/invoice/${paymentHash}`,
|
||||
{
|
||||
headers: {
|
||||
'Grpc-Metadata-macaroon': foundAddress.invoiceMacaroon,
|
||||
}
|
||||
}
|
||||
axiosConfig
|
||||
);
|
||||
|
||||
if (!response.data) {
|
||||
@ -124,6 +128,11 @@ export default async function handler(req, res) {
|
||||
|
||||
results.processed++;
|
||||
} 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);
|
||||
results.errors++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user