Files
Jellystat/backend/tasks/SyncTask.js
Thegan Govender 550e1d3f7c v1.0.4.10 Beta
2023-06-18 21:02:18 +02:00

36 lines
590 B
JavaScript

const db = require("../db");
const sync = require("../sync");
async function SyncTask(interval) {
console.log("LibraryMonitor Interval: " + interval);
setInterval(async () => {
try {
const { rows: config } = await db.query(
'SELECT * FROM app_config where "ID"=1'
);
if (config.length===0 || config[0].JF_HOST === null || config[0].JF_API_KEY === null) {
return;
}
sync.fullSync();
} catch (error) {
// console.log(error);
return [];
}
}, interval);
}
module.exports = {
SyncTask,
};