🎨 moved checkloop outside main loop function
This commit is contained in:
parent
3577f3df55
commit
806b3198a1
2 changed files with 22 additions and 13 deletions
8
app.js
8
app.js
|
@ -42,6 +42,11 @@ app.listen(4000);
|
|||
(async function () {
|
||||
for await (const time of setInterval(config.checkperiod * 10)) {
|
||||
console.log("Checking for spaces...");
|
||||
await loop();
|
||||
}
|
||||
})();
|
||||
|
||||
async function loop() {
|
||||
for (const space of spaces) {
|
||||
console.log(`Checking ${space.id}...`);
|
||||
let o = await checkSpace(space);
|
||||
|
@ -55,8 +60,7 @@ app.listen(4000);
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
// HELPER FUNCTIONS
|
||||
async function checkSpace(space) {
|
||||
|
|
|
@ -8,5 +8,10 @@
|
|||
"node-cache": "^5.1.2",
|
||||
"node-fetch": "2",
|
||||
"prisma": "^4.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"generate": "npx prisma generate dev",
|
||||
"migrate": "npx prisma migrate"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue