18 lines
623 B
JavaScript
18 lines
623 B
JavaScript
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));
|
|
}
|