Check for updates every minute

This commit is contained in:
2023-06-23 20:16:48 +02:00
parent e8552966ec
commit f843ee1339

View File

@ -86,7 +86,7 @@ function formatUpdateMessage(update) {
} }
// Check for timetable updates // Check for timetable updates
setTimeout(async () => { setInterval(async () => {
const history = await timetable.getUpdates(); const history = await timetable.getUpdates();
const lastCheck = await db.getObjectDefault("/lastTimetableUpdate", 0); const lastCheck = await db.getObjectDefault("/lastTimetableUpdate", 0);
const updates = history.filter((entry) => entry.updatedAt > lastCheck); const updates = history.filter((entry) => entry.updatedAt > lastCheck);
@ -104,7 +104,7 @@ setTimeout(async () => {
client.sendHtmlMessage(roomId, plainText(message), message); client.sendHtmlMessage(roomId, plainText(message), message);
} }
} }
}, 1000); }, 1000 * 60);
// Handle events // Handle events
client.on("Room.timeline", async function (event, room) { client.on("Room.timeline", async function (event, room) {