From 82716b4cec7df7629823651a03aaefeac45c1084 Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Sun, 3 Nov 2019 19:55:01 +0000 Subject: [PATCH] =?UTF-8?q?=E2=8F=B2=F0=9F=8F=97=20Checkpoint=20./server.j?= =?UTF-8?q?s:933874/6123?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server.js b/server.js index 3b0db44..f65643b 100644 --- a/server.js +++ b/server.js @@ -76,8 +76,10 @@ const listener = app.listen(process.env.PORT, function() { const loop = () => { console.log("loop", lastClosed); if (lastSeen < new Date() - 2 * 60 * 1000 && lastClosed < lastSeen) { + // the Fuz is newly closed, notify on matrix and write file to survive reboot lastClosed = new Date(); } + setTimeout(loop, 10 * 1000); }; setTimeout(loop, 1 * 1000); // give some time for presence button to show up (1 min)