mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-04-19 19:01:19 +00:00
Schedule invoices cron, add polling logs
This commit is contained in:
parent
6978fb06dd
commit
473595cf90
@ -79,13 +79,14 @@ export default async function handler(req, res) {
|
||||
// Start polling for this zap request
|
||||
let attempts = 0;
|
||||
const pollInterval = setInterval(async () => {
|
||||
console.log('Polling for invoice', attempts);
|
||||
try {
|
||||
console.log('Polling for invoice', attempts);
|
||||
const pollResponse = await axios.get(`${BACKEND_URL}/api/invoices/polling`, {
|
||||
headers: {
|
||||
'Authorization': PLEBDEVS_API_KEY
|
||||
}
|
||||
});
|
||||
console.log('Polling response', pollResponse.data);
|
||||
|
||||
// If no pending invoices or we've reached max attempts, stop polling
|
||||
if (pollResponse.data.pending === 0 || attempts >= 120) {
|
||||
|
@ -4,10 +4,14 @@
|
||||
{
|
||||
"path": "/api/users/subscription/cron",
|
||||
"schedule": "0 0 * * *"
|
||||
},
|
||||
{
|
||||
"path": "/api/invoices/polling",
|
||||
"schedule": "*/10 * * * *"
|
||||
}
|
||||
],
|
||||
"functions": {
|
||||
"src/pages/api/lightning-address/lnd.js": {
|
||||
"src/pages/api/invoices/polling.js": {
|
||||
"maxDuration": 120
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user