Fixed startup failure bug

This commit is contained in:
Skylar Grant 2023-11-13 18:41:55 -05:00
parent 9e6e813b4c
commit 0b6794fb89
1 changed files with 6 additions and 0 deletions

View File

@ -9,9 +9,15 @@ portal.start();
dbfn.run(`UPDATE timestamps SET value = ${Date.now()} WHERE key = 'process_start'`).catch(err => console.error(`Error setting process start time: ${err}`));
// Initialization, which then calls main()
fn.commands.refreshConfig().then(res => {
if (process.env.DEBUG) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: ${res.status}`);
config = res.config;
const shutdownNextCycleQuery = "UPDATE status SET value = 0 WHERE key = 'shutdown_next_cycle'";
dbfn.run(shutdownNextCycleQuery).then(res => {
if (process.env.DEBUG) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: ${res.status}`);
console.log(`[${(Date.now() - config.timestamps.procStart) / 1000}] I: Shutdown flag reset.`);
}).catch(err => console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] E: ${err}`));
// Setup for use with the Pi's GPIO pins
switch (process.env.ONPI) {
case 'true':