From d1ac9663a91e934ad69187f849c095c732fd05bc Mon Sep 17 00:00:00 2001 From: ryzetech Date: Tue, 24 Jan 2023 10:55:52 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fixed=20recaching=20of=20ctdo=20?= =?UTF-8?q?due=20to=20a=20shit=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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."); }