diff --git a/app.js b/app.js index 4f00a5d..9a996e7 100644 --- a/app.js +++ b/app.js @@ -71,9 +71,7 @@ async function loop() { console.error(`The space ${space.id} might not be reachable. Please check the endpoint.`); continue; } - if (JSON.stringify(response) != JSON.stringify(cache.get(space.id))) { - cache.set(space.id, response); - + if (response.open != cache.get(space.id)) { // update or create the space in the database let update = await prisma.space.upsert({ where: { id: space.id }, @@ -92,7 +90,9 @@ async function loop() { }); changecount++; + console.debug(`Space ${space.id} changed to ${response.open ? "open" : "closed"}.`); } + cache.set(space.id, response.open); } console.log(new Date(), "Check complete, updated", changecount, "spaces."); }