aboutsummaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@gmail.com>2022-11-03 17:15:40 +0200
committerJoel Kronqvist <work.joelkronqvist@gmail.com>2022-11-03 17:15:40 +0200
commit5f74d40fa736745651514853afdca3ed44e5ae74 (patch)
tree84dba0e9a48ae71fb61fb8134d2b895cac8ed34a /server.js
parentcf1dd1d7bd128bf770159032975bc014497507ca (diff)
downloadLYLLRuoka-5f74d40fa736745651514853afdca3ed44e5ae74.tar.gz
LYLLRuoka-5f74d40fa736745651514853afdca3ed44e5ae74.zip
Made server update foods at monday morning instead of updating them just randomly once a week.
Diffstat (limited to 'server.js')
-rw-r--r--server.js14
1 files changed, 3 insertions, 11 deletions
diff --git a/server.js b/server.js
index 66f5b19..c496b14 100644
--- a/server.js
+++ b/server.js
@@ -49,18 +49,10 @@ async function init()
// Update...
// ...shifts and classes
await updateDB.update(SQLDB, "../Updation/shifts.txt", "../Updation/vanhalops.csv", "../Updation/uusilops.csv");
- console.log("Shifts and classes updated.");
// ...foods
- await food.build(SQLDB);
- setInterval(
- () =>
- {
- food.build(SQLDB);
- },
- 7 * 24 * 60 * 60 * 1000
- );
- console.log("Foods updated.")
-
+ run_at_monday_mornings(() => food.build(SQLDB));
+ if ((new Date()).getDay() !== 1) // update if it's not monday. if it's monday, it has already been run by the scheduler above.
+ await food.build(SQLDB);
// server code
async function server(req, res)
{