diff options
author | Joel Kronqvist <work.joelkronqvist@gmail.com> | 2022-11-03 17:15:40 +0200 |
---|---|---|
committer | Joel Kronqvist <work.joelkronqvist@gmail.com> | 2022-11-03 17:15:40 +0200 |
commit | 5f74d40fa736745651514853afdca3ed44e5ae74 (patch) | |
tree | 84dba0e9a48ae71fb61fb8134d2b895cac8ed34a /server.js | |
parent | cf1dd1d7bd128bf770159032975bc014497507ca (diff) | |
download | LYLLRuoka-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.js | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -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) { |