correction to monitor opendock activation
This commit is contained in:
@@ -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");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user