refactor: restructure main function and setInterval for better readability and execution flow
This commit is contained in:
8
index.js
8
index.js
@@ -26,8 +26,7 @@ async function getTimetabe() {
|
||||
return timetable;
|
||||
}
|
||||
|
||||
|
||||
setInterval(async () => {
|
||||
async function main() {
|
||||
const timetable = await getTimetabe();
|
||||
|
||||
if (!timetable || timetable.length === 0) {
|
||||
@@ -138,5 +137,10 @@ setInterval(async () => {
|
||||
}
|
||||
|
||||
console.log(`✅ Sync done — Created: ${created}, Updated: ${updated}, Skipped: ${skipped}`);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
setInterval(async () => {
|
||||
await main();
|
||||
}, 1000 * 60 * 30); // Alle 30 Minuten aktualisieren
|
||||
Reference in New Issue
Block a user