mirror of
https://github.com/BreizhHardware/Jellystat.git
synced 2026-01-18 16:27:20 +01:00
task manager implementation to start/stop tasks WIP implemented socket client for internal communication between threads - needs more testing as connection string is hardcoded added loopback in ws server to pass through toast ws messages from threads - needs more testing fixed potential bug during config fetch function when syncing
22 lines
514 B
JavaScript
22 lines
514 B
JavaScript
const { parentPort } = require("worker_threads");
|
|
const sync = require("../routes/sync");
|
|
|
|
async function runPlaybackReportingPluginSyncTask() {
|
|
try {
|
|
await sync.syncPlaybackPluginData();
|
|
|
|
parentPort.postMessage({ status: "complete" });
|
|
} catch (error) {
|
|
parentPort.postMessage({ status: "error", message: error.message });
|
|
|
|
console.log(error);
|
|
return [];
|
|
}
|
|
}
|
|
|
|
parentPort.on("message", (message) => {
|
|
if (message.command === "start") {
|
|
runPlaybackReportingPluginSyncTask();
|
|
}
|
|
});
|