uptime-kuma/server/jobs.js

29 lines
522 B
JavaScript
Raw Normal View History

const path = require("path");
const Bree = require("bree");
const { SHARE_ENV } = require("worker_threads");
const jobs = [
{
name: "clear-old-data",
interval: "every 1 minute",
}
];
const initBackgroundJobs = function (args) {
const bree = new Bree({
root: path.resolve("server", "jobs"),
jobs,
worker: {
env: SHARE_ENV,
workerData: args,
},
});
bree.start();
return bree;
};
module.exports = {
initBackgroundJobs
};