🐛 fixed recaching of ctdo due to a shit api
This commit is contained in:
parent
ce19124286
commit
d1ac9663a9
1 changed files with 3 additions and 3 deletions
6
app.js
6
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.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue