mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-03-18 21:30:35 +01:00
36 lines
590 B
JavaScript
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,
|
|
};
|