Run scheduled tasks through application database
Validate and deploy staging / validate (push) Successful in 18s
Validate and deploy staging / deploy (push) Successful in 44s

This commit is contained in:
JB
2026-07-26 10:38:07 -04:00
parent 548d19d9ea
commit f5eb2fd663
8 changed files with 221 additions and 14 deletions
+17
View File
@@ -0,0 +1,17 @@
const endpoint = process.env.SCHEDULER_URL;
const token = process.env.SCHEDULER_TOKEN;
if (!endpoint || !token) throw new Error('SCHEDULER_URL and SCHEDULER_TOKEN are required.');
while (true) {
try {
const response = await fetch(endpoint, {
method: 'POST',
headers: { authorization: `Bearer ${token}` }
});
if (!response.ok) throw new Error(`Scheduler endpoint returned HTTP ${response.status}.`);
console.log(`Scheduler tick: ${JSON.stringify(await response.json())}`);
} catch (error) {
console.error('Scheduler tick failed', error);
}
await new Promise((resolve) => setTimeout(resolve, 60_000));
}