correction to monitor opendock activation

This commit is contained in:
2026-03-11 16:23:04 -05:00
parent 4f24fe4660
commit bf7d765989
5 changed files with 41 additions and 14 deletions

View File

@@ -3,8 +3,18 @@
* we will stop jobs, stop cycles
*/
import { dbCleanup } from "../db/dbCleanup.controller.js";
import type { Setting } from "../db/schema/settings.schema.js";
import { resumeCronJob, stopCronJob } from "../utils/croner.utils.js";
import { monitorReleaseChanges } from "../opendock/openDockRreleaseMonitor.utils.js";
import {
killOpendockSocket,
opendockSocketMonitor,
} from "../opendock/opendockSocketMonitor.utils.js";
import {
createCronJob,
resumeCronJob,
stopCronJob,
} from "../utils/croner.utils.js";
export const featureControl = async (data: Setting) => {
// when a feature is changed to active or deactivated we will update the cron.
@@ -13,4 +23,15 @@ export const featureControl = async (data: Setting) => {
} else {
stopCronJob(data.name);
}
if (data.name === "opendock_sync" && data.active) {
opendockSocketMonitor();
monitorReleaseChanges();
createCronJob("opendockAptCleanup", "0 30 5 * * *", () =>
dbCleanup("opendockApt", 90),
);
} else {
killOpendockSocket();
stopCronJob("opendockAptCleanup");
}
};